Add missing nullptr checks.

GetPersistentExpressionStateForLanguage() can return a nullptr if it
cannot construct a typesystem. This patch adds missing nullptr checks
at all uses.

Inspired by rdar://problem/58317195

Differential Revision: https://reviews.llvm.org/D72413
This commit is contained in:
Adrian Prantl
2020-01-08 14:18:47 -08:00
parent bdd88b7ed3
commit e9331a56fe
8 changed files with 42 additions and 29 deletions

View File

@@ -283,6 +283,8 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) {
PersistentExpressionState *persistent_state =
m_target.GetPersistentExpressionStateForLanguage(GetLanguage());
if (!persistent_state)
return;
const size_t var_count_before = persistent_state->GetSize();