aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-12-15 14:36:41 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-12-15 20:36:57 -0300
commit6bdce6ad951e10b3830b8a6a763961038e1f7828 (patch)
treeba3ff7b231ef8d4b7aad5f050fb89f3b6255428d
parentb2519fa1f17be24956772f5a5101a914cbbdb77d (diff)
Improved Generator::replaceTemplateVariables method to avoid segfaults.
Reviewed by Hugo Parente <hugo.lima@openbossa.org>
-rw-r--r--generator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/generator.cpp b/generator.cpp
index 99a74d30..0f91a0e6 100644
--- a/generator.cpp
+++ b/generator.cpp
@@ -200,7 +200,8 @@ bool Generator::hasDefaultConstructor(const AbstractMetaType *type)
void Generator::replaceTemplateVariables(QString &code, const AbstractMetaFunction *func)
{
const AbstractMetaClass *cpp_class = func->ownerClass();
- code.replace("%TYPE", cpp_class->name());
+ if (cpp_class)
+ code.replace("%TYPE", cpp_class->name());
foreach (AbstractMetaArgument *arg, func->arguments())
code.replace("%" + QString::number(arg->argumentIndex() + 1), arg->argumentName());