[dia] [scan-build] Null dereference (potentially)



commit 628b661cf44ab9ba96607cbc79a338379fff19d6
Author: Hans Breuer <hans breuer org>
Date:   Sun Dec 13 13:41:19 2009 +0100

    [scan-build] Null dereference (potentially)
    
    Checking param->name before param->name[0] although the
    GUI would not allow the case to happen. An empty param->name
    still is "".

 objects/UML/umloperation.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/objects/UML/umloperation.c b/objects/UML/umloperation.c
index 6e43444..c5844cd 100644
--- a/objects/UML/umloperation.c
+++ b/objects/UML/umloperation.c
@@ -337,7 +337,7 @@ uml_get_operation_string (UMLOperation *operation)
     len += (param->name ? strlen (param->name) : 0);
     if (param->type != NULL) {
       len += strlen (param->type);
-      if (param->type[0] && param->name[0]) {
+      if (param->type[0] && (param->name != NULL && param->name[0])) {
         len += 1;
       }
     }
@@ -396,7 +396,7 @@ uml_get_operation_string (UMLOperation *operation)
     strcat (str, param->name ? param->name : "");
 
     if (param->type != NULL) {
-      if (param->type[0] && param->name[0]) {
+      if (param->type[0] && (param->name != NULL && param->name[0])) {
         strcat (str, ":");
       }
       strcat (str, param->type);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]