Fix null pointer dereference
[claws.git] / src / plugins / vcalendar / libical / libical / icalmime.c
index 2ed9bac26c390b605dd8d8d111387624c134b6c8..b7844140123e85fa6579a1d48262b41855e1f84c 100644 (file)
@@ -167,7 +167,7 @@ icalcomponent* icalmime_parse(char* (*get_string)(char *s, size_t size,
 {
     struct sspm_part *parts;
     int i, last_level=0;
-    icalcomponent *root=0, *parent=0, *comp=0, *last = 0;
+    icalcomponent *root = NULL, *parent = NULL, *comp = NULL, *last = NULL;
     size_t alloc_len = NUM_PARTS * sizeof(struct sspm_part);
 
     if ( (parts = (struct sspm_part *)
@@ -309,7 +309,7 @@ line between the header and the previous boundary\?";
        }
 
        if(parts[i].level == last_level && last_level != 0){
-           icalerror_assert(parent!=0,"No parent for adding component");
+           icalerror_assert(parent != NULL, "No parent for adding component");
 
            icalcomponent_add_component(parent,comp);
 
@@ -327,7 +327,7 @@ line between the header and the previous boundary\?";
            last_level = parts[i].level;
 
        } else if (parts[i].level < last_level){
-
+            icalerror_assert(parent != NULL, "No parent");
            parent = icalcomponent_get_parent(parent);
            icalcomponent_add_component(parent,comp);