Prechádzať zdrojové kódy

Fixed bad JSON for accounts that do not have a 'summary' field.

default 3 rokov pred
rodič
commit
177bf03e10
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      mastoapi.c

+ 6 - 1
mastoapi.c

@@ -456,7 +456,12 @@ xs_dict *mastoapi_account(const xs_dict *actor)
         acct = xs_dict_append(acct, "created_at", date);
     }
 
-    acct = xs_dict_append(acct, "note",         xs_dict_get(actor, "summary"));
+    const char *note = xs_dict_get(actor, "summary");
+    if (xs_is_null(note))
+        note = "";
+
+    acct = xs_dict_append(acct, "note", note);
+
     acct = xs_dict_append(acct, "url",          id);
 
     xs *avatar  = NULL;