[Kdenlive-devel] [PATCH 11/16] projectlist.cpp: check for null before referencing

Mikko Rapeli mikko.rapeli at iki.fi
Fri Aug 10 12:17:12 UTC 2012


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 df1ac4f..0397801 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<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());
-- 
1.7.10.4





More information about the Kdenlive mailing list