summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2013-08-27 10:06:02 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2013-08-27 10:06:02 (GMT)
commit376cb74cc75230516b27870038f459ae96d1968a (patch)
tree6e09fcff60c80c6a9abc027c58e0f95bd46911b9 /src/util.cpp
parentc375fe1a8509c3a29db0fa56451271d3b442e429 (diff)
downloadDoxygen-376cb74cc75230516b27870038f459ae96d1968a.zip
Doxygen-376cb74cc75230516b27870038f459ae96d1968a.tar.gz
Doxygen-376cb74cc75230516b27870038f459ae96d1968a.tar.bz2
Bug 706874 - Doxygen crash if missing new-line in a snippet
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 58214bd..781a678 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -7682,6 +7682,7 @@ QCString extractBlock(const QCString text,const QCString marker)
p=i+1;
}
l1=p;
+ int lp=i;
if (found)
{
while ((i=text.find('\n',p))!=-1)
@@ -7692,10 +7693,15 @@ QCString extractBlock(const QCString text,const QCString marker)
break;
}
p=i+1;
+ lp=i;
}
}
+ if (l2==-1) // marker at last line without newline (see bug706874)
+ {
+ l2=lp;
+ }
//printf("text=[%s]\n",text.mid(l1,l2-l1).data());
- return text.mid(l1,l2-l1);
+ return l2>l1 ? text.mid(l1,l2-l1) : QCString();
}
/** Returns a string representation of \a lang. */