From 97c3a2bc6e3fa7fce52062374b6a31dce2c500f2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 30 Oct 2014 21:09:10 -0700 Subject: [PATCH] Fix a crash when we fail to parse a typexpr in a global declaration. --- sourcepawn/compiler/sc1.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sourcepawn/compiler/sc1.cpp b/sourcepawn/compiler/sc1.cpp index 9f8e80b7..5d5d8132 100644 --- a/sourcepawn/compiler/sc1.cpp +++ b/sourcepawn/compiler/sc1.cpp @@ -1445,7 +1445,11 @@ static void dodecl(const token_t *tok) if (tok->id == tNEW) flags |= DECLFLAG_OLD; - parse_decl(&decl, flags); + if (!parse_decl(&decl, flags)) { + // Error will have been reported earlier. Reset |decl| so we don't crash + // thinking tag -1 has every flag. + decl.type.tag = 0; + } if (!decl.opertok && (tok->id == tNEW || decl.has_postdims || !lexpeek('('))) { if (tok->id == tNEW && decl.is_new)