summaryrefslogtreecommitdiffstats
path: root/src/htmldocvisitor.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2014-04-19 14:27:11 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2014-04-19 14:27:11 (GMT)
commit653a2a8b123b79835af9f684f8b92ef7f88712aa (patch)
tree548f3cface232e706f202ab718ce01ca2f387b57 /src/htmldocvisitor.cpp
parent8ba739ad1ecde1036bfe2e364aee378e137f6dff (diff)
downloadDoxygen-653a2a8b123b79835af9f684f8b92ef7f88712aa.zip
Doxygen-653a2a8b123b79835af9f684f8b92ef7f88712aa.tar.gz
Doxygen-653a2a8b123b79835af9f684f8b92ef7f88712aa.tar.bz2
Bug 728530 - Crash on \addindex \term
Diffstat (limited to 'src/htmldocvisitor.cpp')
-rw-r--r--src/htmldocvisitor.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 9939ef2..c70f2c5 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -44,27 +44,30 @@ static QCString convertIndexWordToAnchor(const QString &word)
QCString result;
const char *str = word.data();
unsigned char c;
- while ((c = *str++))
- {
- if ((c >= 'a' && c <= 'z') || // ALPHA
- (c >= 'A' && c <= 'A') || // ALPHA
- (c >= '0' && c <= '9') || // DIGIT
- c == '-' ||
- c == '.' ||
- c == '_' ||
- c == '~'
- )
- {
- result += c;
- }
- else
+ if (str)
+ {
+ while ((c = *str++))
{
- char enc[4];
- enc[0] = '%';
- enc[1] = hex[(c & 0xf0) >> 4];
- enc[2] = hex[c & 0xf];
- enc[3] = 0;
- result += enc;
+ if ((c >= 'a' && c <= 'z') || // ALPHA
+ (c >= 'A' && c <= 'A') || // ALPHA
+ (c >= '0' && c <= '9') || // DIGIT
+ c == '-' ||
+ c == '.' ||
+ c == '_' ||
+ c == '~'
+ )
+ {
+ result += c;
+ }
+ else
+ {
+ char enc[4];
+ enc[0] = '%';
+ enc[1] = hex[(c & 0xf0) >> 4];
+ enc[2] = hex[c & 0xf];
+ enc[3] = 0;
+ result += enc;
+ }
}
}
return result;