diff options
author | Michael Vetter <jubalh@iodoru.org> | 2022-03-14 16:02:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 16:02:09 +0100 |
commit | 4e95641014c3c81393390c38fcda2a7de0f3ba35 (patch) | |
tree | a033f3cfae5af5516a5da0b5e679626e762263e7 /src/xmpp/connection.c | |
parent | 9eee52d14caba9343c568390674d5cecc1a4d863 (diff) | |
parent | 8c55294352fd8f15a2e2f7ca4e8972d85b7f4b32 (diff) | |
download | profani-tty-4e95641014c3c81393390c38fcda2a7de0f3ba35.tar.gz |
Merge pull request #1648 from profanity-im/refactor-editor
Refactor editor & some other parts
Diffstat (limited to 'src/xmpp/connection.c')
-rw-r--r-- | src/xmpp/connection.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index c5475258..d601de22 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -747,6 +747,8 @@ connection_get_ctx(void) const char* connection_get_fulljid(void) { + if (!conn.xmpp_conn) + return NULL; const char* jid = xmpp_conn_get_bound_jid(conn.xmpp_conn); if (jid) { return jid; @@ -759,10 +761,11 @@ char* connection_get_barejid(void) { const char* jid = connection_get_fulljid(); - char* result; + if (!jid) + return NULL; Jid* jidp = jid_create(jid); - result = strdup(jidp->barejid); + char* result = strdup(jidp->barejid); jid_destroy(jidp); return result; @@ -772,8 +775,9 @@ char* connection_get_user(void) { const char* jid = connection_get_fulljid(); - char* result; - result = strdup(jid); + if (!jid) + return NULL; + char* result = strdup(jid); char* split = strchr(result, '@'); *split = '\0'; |