From ccc6dab51298ecf40b95355e2cb8c6ddc76430af Mon Sep 17 00:00:00 2001 From: mjentsch Date: Sun, 6 Sep 2015 22:26:00 +0200 Subject: [PATCH] fix input validation --- tgp-2prpl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tgp-2prpl.c b/tgp-2prpl.c index f4d381b..ca87be8 100644 --- a/tgp-2prpl.c +++ b/tgp-2prpl.c @@ -304,8 +304,9 @@ void p2tgl_chat_update (PurpleChat *chat, tgl_peer_id_t id, int admin_id, const tgl_chat_id_t p2tgl_chat_get_id (PurpleChat *PC) { char *name = g_hash_table_lookup (purple_chat_get_components (PC), "id"); - if (! atoi (name)) { + if (! name || ! atoi (name)) { warning ("p2tgl_chat_id_get: no id found in chat %s", PC->alias); + return TGL_MK_CHAT(0); } return TGL_MK_CHAT(atoi (name)); }