Fix a tnode-related crash in syntax highlighting

Adds a new test too.
This commit is contained in:
ridiculousfish
2018-01-21 02:17:02 -08:00
parent 9c7909c006
commit ae9b5871fb
2 changed files with 12 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ enum token_type redirection_type(tnode_t<grammar::redirection> redirection, cons
}
if (out_target != NULL) {
tnode_t<grammar::tok_string> target = redirection.child<1>(); // like &1 or file path
*out_target = target ? target.get_source(src) : wcstring();
*out_target = target.has_source() ? target.get_source(src) : wcstring();
}
return result;
}