syntax_color: add NULL checking in macro_key_push function

Summary: add NULL checking in macro_key_push function

Reviewers: Jaehyun_Cho, bowonryu, NikaWhite, Hermet

Reviewed By: NikaWhite, Hermet

Differential Revision: https://phab.enlightenment.org/D4235
This commit is contained in:
Taehyub Kim 2016-08-17 22:22:53 +09:00 committed by Hermet Park
parent 1665ac9ba6
commit a47b12bd53
1 changed files with 5 additions and 1 deletions

View File

@ -191,7 +191,11 @@ macro_key_push(color_data *cd, char *str)
//cutoff "()" from the macro name
char *cut = strchr(key, '(');
if (cut) key = strndup(str, cut - str);
if (cut)
{
key = strndup(str, cut - str);
if (!key) return;
}
char tmp[2];
tmp[0] = key[0];