diff --git a/src/commentscan.l b/src/commentscan.l index 65c352e82a..fc53c573f1 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -1842,8 +1842,14 @@ RCSTAG "$"{ID}":"[^\n$]+"$" } else { - delete guards.pop(); - BEGIN( GuardParamEnd ); + GuardedSection *s = guards.pop(); + bool parentVisible = s->parentVisible(); + delete s; + if (parentVisible) + { + enabledSectionFound=TRUE; + BEGIN( GuardParamEnd ); + } } } {CMD}"else"/{NW} {