diff --git a/src/checkbufferoverrun.cpp b/src/checkbufferoverrun.cpp index 70ed7c5a1..9e1a038f6 100644 --- a/src/checkbufferoverrun.cpp +++ b/src/checkbufferoverrun.cpp @@ -93,7 +93,7 @@ void CheckBufferOverrun::bufferOverrun(const Token *tok) void CheckBufferOverrun::dangerousStdCin(const Token *tok) { - if (_settings->_showAll == false) + if (_settings && _settings->_showAll == false) return; reportError(tok, Severity::possibleError, "dangerousStdCin", "Dangerous usage of std::cin, possible buffer overrun"); @@ -101,7 +101,7 @@ void CheckBufferOverrun::dangerousStdCin(const Token *tok) void CheckBufferOverrun::strncatUsage(const Token *tok) { - if (_settings->_showAll == false) + if (_settings && _settings->_showAll == false) return; reportError(tok, Severity::possibleError, "strncatUsage", "Dangerous usage of strncat. Tip: the 3rd parameter means maximum number of characters to append"); @@ -114,7 +114,7 @@ void CheckBufferOverrun::outOfBounds(const Token *tok, const std::string &what) void CheckBufferOverrun::sizeArgumentAsChar(const Token *tok) { - if (_settings->_showAll == false) + if (_settings && _settings->_showAll == false) return; reportError(tok, Severity::possibleError, "sizeArgumentAsChar", "The size argument is given as a char constant");