fix null pointer deref clang's static analyzer believes in

Check cur_term before exit_attribute_mode.
This commit is contained in:
Aaron Gyes 2016-10-07 15:43:59 -07:00
parent b71aa8f9e8
commit 22558f9e7b

View File

@ -148,7 +148,7 @@ int builtin_set_color(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
// Test if we have at least basic support for setting fonts, colors and related bits - otherwise
// just give up...
if (!exit_attribute_mode) {
if (cur_term == NULL || !exit_attribute_mode) {
return STATUS_BUILTIN_ERROR;
}