]> git.sesse.net Git - kdenlive/commitdiff
projectlist.cpp: check for null before referencing
authorMikko Rapeli <mikko.rapeli@iki.fi>
Fri, 10 Aug 2012 12:17:12 +0000 (14:17 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 2 Sep 2012 09:40:49 +0000 (11:40 +0200)
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

index 7f36c74d71d45e19f6bc441877c2a22dc02ea069..c6f7368b89fae086a5e70dd0c1eb2ca2cc54a8a8 100644 (file)
@@ -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<QPixmap>(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());