Python plugin: Folder: Return None for folders without an id
authorHolger Berndt <hb@claws-mail.org>
Sat, 10 Aug 2013 12:28:01 +0000 (14:28 +0200)
committerHolger Berndt <hb@claws-mail.org>
Sun, 18 Aug 2013 12:32:50 +0000 (14:32 +0200)
src/plugins/python/foldertype.c

index 3afd0cc..9080787 100644 (file)
@@ -265,11 +265,14 @@ PyObject* clawsmail_folder_new(FolderItem *folderitem)
     return NULL;
 
   id = folder_item_get_identifier(folderitem);
-  arglist = Py_BuildValue("(s)", id);
-  g_free(id);
-  ff = (clawsmail_FolderObject*) PyObject_CallObject((PyObject*) &clawsmail_FolderType, arglist);
-  Py_DECREF(arglist);
-  return (PyObject*)ff;
+  if(id) {
+    arglist = Py_BuildValue("(s)", id);
+    g_free(id);
+    ff = (clawsmail_FolderObject*) PyObject_CallObject((PyObject*) &clawsmail_FolderType, arglist);
+    Py_DECREF(arglist);
+    return (PyObject*)ff;
+  }
+  Py_RETURN_NONE;
 }
 
 FolderItem* clawsmail_folder_get_item(PyObject *self)