aboutsummaryrefslogtreecommitdiffstats
path: root/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-09-27 14:57:31 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:10 -0300
commitaa4fe2fa4520de55c8f074ccdd6b8378ca448391 (patch)
tree7736566462f0660b2b384582dcf7accfdb1860ad /abstractmetabuilder.cpp
parenteac6125bac2029389594c8bad0b0fa48cffe1d6b (diff)
Fixes segmentation fault caused by bad handling of global enums.
Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Ara├║jo <renato.filho@openbossa.org>
Diffstat (limited to 'abstractmetabuilder.cpp')
-rw-r--r--abstractmetabuilder.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index 6b22a6ddf..a84d130b9 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -788,23 +788,23 @@ int AbstractMetaBuilder::figureOutEnumValue(const QString &stringValue,
matched = true;
} else {
- AbstractMetaEnumValue *ev = 0;
-
- if (metaEnum && (ev = metaEnum->values().find(s))) {
- v = ev->value();
- matched = true;
-
- } else if (metaEnum && (ev = metaEnum->enclosingClass()->findEnumValue(s, metaEnum))) {
- v = ev->value();
- matched = true;
-
- } else {
- if (metaEnum)
+ AbstractMetaEnumValue* ev = 0;
+ AbstractMetaClass* enumEnclosingClass = metaEnum ? metaEnum->enclosingClass() : 0;
+
+ if (metaEnum) {
+ if (ev = metaEnum->values().find(s)) {
+ v = ev->value();
+ matched = true;
+ } else if (enumEnclosingClass && (ev = enumEnclosingClass->findEnumValue(s, metaEnum))) {
+ v = ev->value();
+ matched = true;
+ } else {
ReportHandler::warning("unhandled enum value: " + s + " in "
- + metaEnum->enclosingClass()->name() + "::"
+ + (enumEnclosingClass ? QString("%1::").arg(enumEnclosingClass->name()) : QString())
+ metaEnum->name());
- else
- ReportHandler::warning("unhandled enum value: Unknown enum");
+ }
+ } else {
+ ReportHandler::warning("unhandled enum value: Unknown enum");
}
}