diff --git a/ctx.cpp b/ctx.cpp index 575b1594..882b294b 100644 --- a/ctx.cpp +++ b/ctx.cpp @@ -1850,6 +1850,11 @@ llvm::Value * FunctionEmitContext::AllocaInst(LLVM_TYPE_CONST llvm::Type *llvmType, const char *name, int align, bool atEntryBlock) { + if (llvmType == NULL) { + assert(m->errorCount > 0); + return NULL; + } + llvm::AllocaInst *inst = NULL; if (atEntryBlock) { // We usually insert it right before the jump instruction at the diff --git a/expr.cpp b/expr.cpp index 93e8fe5a..9c3a3836 100644 --- a/expr.cpp +++ b/expr.cpp @@ -3350,11 +3350,13 @@ StructMemberExpr::GetType() const { return NULL; const Type *elementType = structType->GetElementType(identifier); - if (elementType == NULL) + if (elementType == NULL) { Error(identifierPos, "Element name \"%s\" not present in struct type \"%s\".%s", identifier.c_str(), structType->GetString().c_str(), getCandidateNearMatches().c_str()); + return NULL; + } const PointerType *pt = dynamic_cast(expr->GetType()); if (structType->IsVaryingType() ||