Fix segfault in expand_alternative_phrase_option

string_tree_get_alternative can return NULL
This commit is contained in:
Gregory Oschwald
2018-01-02 13:28:51 -08:00
parent 18cc0e37e6
commit 2f6749fe03
2 changed files with 16 additions and 2 deletions

View File

@@ -1491,8 +1491,12 @@ void expand_alternative_phrase_option(cstring_array *strings, khash_t(str_set) *
for (; !string_tree_iterator_done(iter); string_tree_iterator_next(iter)) {
char_array_clear(temp_string);
string_tree_iterator_foreach_token(iter, token, {
log_debug("token=%s\n", token);
char_array_append(temp_string, token);
if (token == NULL) {
log_debug("token=NULL\n");
} else {
log_debug("token=%s\n", token);
char_array_append(temp_string, token);
}
})
char_array_terminate(temp_string);