summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2018-02-07 11:07:22 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2018-02-07 11:07:22 +0100
commit1e6d787401b548cf3d5cc57d9a0d0f25f1254bf7 (patch)
treeadac6bd7b7723f679deb8a17cd156a9524f9c67b
parentf8fbc1e1ab9b01c651c7da0652eac8631894c44c (diff)
downloadirssi-1e6d787401b548cf3d5cc57d9a0d0f25f1254bf7.zip
ensure cap_supported is existent yet
-rw-r--r--src/common.h2
-rw-r--r--src/perl/irc/Irc.xs16
2 files changed, 10 insertions, 8 deletions
diff --git a/src/common.h b/src/common.h
index 46d0c45a..746aad4e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -6,7 +6,7 @@
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
-#define IRSSI_ABI_VERSION 14
+#define IRSSI_ABI_VERSION 15
#define DEFAULT_SERVER_ADD_PORT 6667
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs
index bb2d27bb..3bf81f9a 100644
--- a/src/perl/irc/Irc.xs
+++ b/src/perl/irc/Irc.xs
@@ -37,14 +37,16 @@ static void perl_irc_server_fill_hash(HV *hv, IRC_SERVER_REC *server)
(void) hv_store(hv, "cap_complete", 12, newSViv(server->cap_complete), 0);
(void) hv_store(hv, "sasl_success", 12, newSViv(server->sasl_success), 0);
- hv_ = newHV();
- g_hash_table_iter_init(&iter, server->cap_supported);
- while (g_hash_table_iter_next(&iter, &key_, &val_)) {
- char *key = (char *)key_;
- char *val = (char *)val_;
- hv_store(hv_, key, strlen(key), new_pv(val), 0);
+ if (server->cap_supported != NULL) {
+ hv_ = newHV();
+ g_hash_table_iter_init(&iter, server->cap_supported);
+ while (g_hash_table_iter_next(&iter, &key_, &val_)) {
+ char *key = (char *)key_;
+ char *val = (char *)val_;
+ hv_store(hv_, key, strlen(key), new_pv(val), 0);
+ }
+ (void) hv_store(hv, "cap_supported", 13, newRV_noinc((SV*)hv_), 0);
}
- (void) hv_store(hv, "cap_supported", 13, newRV_noinc((SV*)hv_), 0);
av = newAV();
for (tmp = server->cap_active; tmp != NULL; tmp = tmp->next)