[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [umbrello] umbrello/codegenerators: Coverity check on master@bd16929, CID 71394: Unchecked dynamic_c
From:       Ralf Habacker <ralf.habacker () freenet ! de>
Date:       2014-12-01 4:44:31
Message-ID: E1XvIqd-0005MJ-IP () scm ! kde ! org
[Download RAW message or body]

Git commit d974b7832136ef1a6f881dad413889c180d6f903 by Ralf Habacker.
Committed on 30/11/2014 at 13:56.
Pushed by habacker into branch 'master'.

Coverity check on master@bd16929, CID 71394: Unchecked dynamic_cast (FORWARD_NULL).

CCBUG:340646

M  +4    -0    umbrello/codegenerators/codeclassfield.cpp

http://commits.kde.org/umbrello/d974b7832136ef1a6f881dad413889c180d6f903

diff --git a/umbrello/codegenerators/codeclassfield.cpp b/umbrello/codegenerators/codeclassfield.cpp
index 092f302..0150283 100644
--- a/umbrello/codegenerators/codeclassfield.cpp
+++ b/umbrello/codegenerators/codeclassfield.cpp
@@ -354,6 +354,10 @@ int CodeClassField::maximumListOccurances()
     if (!parentIsAttribute())
     {
         UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
+        if (!role) {
+            uError() << "no valid parent object";
+            return -1;
+        }
         QString multi = role->multiplicity();
         // ush. IF we had a multiplicty object, this would be much easier.
         if (!multi.isEmpty())

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic