diff options
author | James Booth <boothj5@gmail.com> | 2013-02-17 19:28:25 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-02-17 19:28:25 +0000 |
commit | 657d1d4a493a30570a657a071943fcd14c7d124c (patch) | |
tree | 2410bc10cfa8eb3e17756284581d18afeb88c4c1 /src/command | |
parent | 893242d361407c9c2635fe57f96fa0d5e52115f5 (diff) | |
download | profani-tty-657d1d4a493a30570a657a071943fcd14c7d124c.tar.gz |
Fixed invalid resource error
Diffstat (limited to 'src/command')
-rw-r--r-- | src/command/command.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c index 11d7a140..13eec811 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -1918,8 +1918,16 @@ _cmd_caps(gchar **args, struct cmd_help_t help) cons_show("You must provide a full jid to the /caps command."); } else { PContact pcontact = contact_list_get_contact(jid->barejid); - Resource *resource = p_contact_get_resource(pcontact, jid->resourcepart); - cons_show_caps(jid->fulljid, resource); + if (pcontact == NULL) { + cons_show("Contact not found in roster: %s", jid->barejid); + } else { + Resource *resource = p_contact_get_resource(pcontact, jid->resourcepart); + if (resource == NULL) { + cons_show("Could not find resource %s, for contact %s", jid->barejid, jid->resourcepart); + } else { + cons_show_caps(jid->fulljid, resource); + } + } } } else { cons_show("You must provide a jid to the /caps command."); |