From bb0f02c5c83c9b19d7442e86f1b392fba1de9624 Mon Sep 17 00:00:00 2001 From: Mikko Rapeli Date: Fri, 10 Aug 2012 14:17:12 +0200 Subject: [PATCH] projectlist.cpp: check for null before referencing Fixes Coverity CID 709302: Dereference before null check (REVERSE_INULL) Dereferencing pointer "this->m_render". [show details] 736 int width = (int)(height * m_render->dar()); ... Dereferencing "this->m_render" before a null check. 749 if (m_render == NULL) { 750 kDebug() << "********* ERROR, NULL RENDR"; 751 return; --- src/projectlist.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 7f36c74d..c6f7368b 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -733,6 +733,10 @@ void ProjectList::slotMissingClip(const QString &id) if (item) { item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled); int height = m_listView->iconSize().height(); + if (m_render == NULL) { + kDebug() << "********* ERROR, NULL RENDR"; + return; + } int width = (int)(height * m_render->dar()); QPixmap pixmap = qVariantValue(item->data(0, Qt::DecorationRole)); if (pixmap.isNull()) { @@ -746,10 +750,6 @@ void ProjectList::slotMissingClip(const QString &id) item->setData(0, Qt::DecorationRole, pixmap); if (item->referencedClip()) { item->referencedClip()->setPlaceHolder(true); - if (m_render == NULL) { - kDebug() << "********* ERROR, NULL RENDR"; - return; - } Mlt::Producer *newProd = m_render->invalidProducer(id); if (item->referencedClip()->getProducer()) { Mlt::Properties props(newProd->get_properties()); -- 2.39.2