diff options
author | Ankit Vani <a@nevitus.org> | 2014-02-06 22:49:40 +0530 |
---|---|---|
committer | Ankit Vani <a@nevitus.org> | 2014-02-06 22:49:40 +0530 |
commit | a45c2e26f87b443e810a407f66defe8d300328b4 (patch) | |
tree | d23bff0593b43203aaa31c543713f77abc4ce527 | |
parent | 431bb200c18df83152eae7dd3a90199833a9cf64 (diff) | |
download | pidgin-a45c2e26f87b443e810a407f66defe8d300328b4.tar.gz |
Fix crash when scanning libgnt
-rw-r--r-- | finch/libgnt/gntkeys.h | 6 | ||||
-rw-r--r-- | finch/libgnt/gntstyle.c | 12 |
2 files changed, 14 insertions, 4 deletions
diff --git a/finch/libgnt/gntkeys.h b/finch/libgnt/gntkeys.h index 8898439579..3fa37f7bcd 100644 --- a/finch/libgnt/gntkeys.h +++ b/finch/libgnt/gntkeys.h @@ -42,7 +42,7 @@ extern char *gnt_key_cdown; extern char *gnt_key_cleft; extern char *gnt_key_cright; -#define SAFE(x) ((x) ? (x) : "") +#define SAFE(x) ((cur_term && (x)) ? (x) : "") #define GNT_KEY_POPUP SAFE(key_f16) /* Apparently */ @@ -62,12 +62,12 @@ extern char *gnt_key_cright; #define GNT_KEY_HOME SAFE(key_home) #define GNT_KEY_END SAFE(key_end) -#define GNT_KEY_ENTER carriage_return +#define GNT_KEY_ENTER SAFE(carriage_return) #define GNT_KEY_BACKSPACE SAFE(key_backspace) #define GNT_KEY_DEL SAFE(key_dc) #define GNT_KEY_INS SAFE(key_ic) -#define GNT_KEY_BACK_TAB (back_tab ? back_tab : SAFE(key_btab)) +#define GNT_KEY_BACK_TAB ((cur_term && back_tab) ? back_tab : SAFE(key_btab)) #define GNT_KEY_CTRL_A "\001" #define GNT_KEY_CTRL_B "\002" diff --git a/finch/libgnt/gntstyle.c b/finch/libgnt/gntstyle.c index fc16f6fc0e..6b1922c994 100644 --- a/finch/libgnt/gntstyle.c +++ b/finch/libgnt/gntstyle.c @@ -48,7 +48,13 @@ const char *gnt_style_get(GntStyle style) char *gnt_style_get_from_name(const char *group, const char *key) { - const char *prg = g_get_prgname(); + const char *prg; + + /* gkfile is NULL when run by gtkdoc-scanobj or g-ir-scanner */ + if (!gkfile) + return NULL; + + prg = g_get_prgname(); if ((group == NULL || *group == '\0') && prg && g_key_file_has_group(gkfile, prg)) group = prg; @@ -202,6 +208,10 @@ void gnt_style_read_actions(GType type, GntBindableClass *klass) char *name; GError *error = NULL; + /* gkfile is NULL when run by gtkdoc-scanobj or g-ir-scanner */ + if (!gkfile) + return; + name = g_strdup_printf("%s::binding", g_type_name(type)); if (g_key_file_has_group(gkfile, name)) |