Skip to content

Commit 135d4c6

Browse files
committed
issue #10950 ASSERT(0) in docnode.cpp
1 parent 6221f43 commit 135d4c6

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

src/docnode.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4544,9 +4544,20 @@ int DocPara::handleCommand(char cmdChar, const QCString &cmdName)
45444544
case CMD_IFILE:
45454545
handleIFile(cmdChar,cmdName);
45464546
break;
4547+
case CMD_SETSCOPE:
4548+
{
4549+
QCString scope;
4550+
parser()->tokenizer.setStateSetScope();
4551+
(void)parser()->tokenizer.lex();
4552+
scope = parser()->context.token->name;
4553+
parser()->context.context = scope;
4554+
//printf("Found scope='%s'\n",qPrint(scope));
4555+
parser()->tokenizer.setStatePara();
4556+
}
4557+
break;
45474558
default:
45484559
// we should not get here!
4549-
ASSERT(0);
4560+
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected command '%s' in paragraph context",qPrint(cmdName));
45504561
break;
45514562
}
45524563
INTERNAL_ASSERT(retval==0 || retval==RetVal_OK || retval==RetVal_SimpleSec ||
@@ -5081,7 +5092,14 @@ int DocPara::handleHtmlEndTag(const QCString &tagName)
50815092
retval=RetVal_EndHtmlDetails;
50825093
break;
50835094
case HTML_BLOCKQUOTE:
5084-
retval=RetVal_EndBlockQuote;
5095+
if (!insideBlockQuote(thisVariant()))
5096+
{
5097+
warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"found </blockquote> tag without matching <blockquote>");
5098+
}
5099+
else
5100+
{
5101+
retval=RetVal_EndBlockQuote;
5102+
}
50855103
break;
50865104
case HTML_BOLD:
50875105
parser()->handleStyleLeave(thisVariant(),children(),DocStyleChange::Bold,tagName);

src/docparser_p.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ inline bool insideLI(const DocNodeVariant *n)
193193
return FALSE;
194194
}
195195

196+
/*! Returns TRUE iff node n is a child of a html list item node */
197+
inline bool insideBlockQuote(const DocNodeVariant *n)
198+
{
199+
while (n)
200+
{
201+
if (std::holds_alternative<DocHtmlBlockQuote>(*n)) return TRUE;
202+
n=parent(n);
203+
}
204+
return FALSE;
205+
}
206+
207+
196208
//---------------------------------------------------------------------------
197209

198210
/*! Returns TRUE iff node n is a child of a unordered html list node */

0 commit comments

Comments
 (0)