Python plugin: Account: Harden string representation
[claws.git] / src / plugins / python / accounttype.c
index d50f2528f3490a17ab807b9cbe81a1391bc757a1..6239eadbaeaa0f4a7efabfac474bbf1156ea1ae8 100644 (file)
@@ -53,7 +53,9 @@ static int Account_compare(clawsmail_AccountObject *obj1, clawsmail_AccountObjec
 
 static PyObject* Account_str(clawsmail_AccountObject *self)
 {
-  return PyString_FromFormat("Account: %s", self->account->account_name);
+  if(self->account && self->account->account_name)
+    return PyString_FromFormat("Account: %s", self->account->account_name);
+  Py_RETURN_NONE;
 }
 
 static PyObject* get_account_name(clawsmail_AccountObject *self, void *closure)