Commit cb7e7ce8 authored by snuverink_j's avatar snuverink_j
Browse files

fix crash by pointer dereferencing with clang

parent 40c359fb
......@@ -85,10 +85,11 @@ namespace Attributes {
void setBool(Attribute &attr, bool val) {
SValue<SRefAttr<bool> > *ref;
if(dynamic_cast<const Bool *>(&attr.getHandler())) {
attr.set(new SValue<bool>(val));
} else if(SValue<SRefAttr<bool> > *ref =
dynamic_cast<SValue<SRefAttr<bool> >*>(&attr.getBase())) {
} else if((attr.isBaseAllocated() == true) &&
(ref = dynamic_cast<SValue<SRefAttr<bool> >*>(&attr.getBase()))) {
const SRefAttr<bool> &value = ref->evaluate();
value.set(val);
} else {
......@@ -236,10 +237,11 @@ namespace Attributes {
void setReal(Attribute &attr, double val) {
SValue<SRefAttr<double> > *ref;
if(dynamic_cast<const Real *>(&attr.getHandler())) {
attr.set(new SValue<double>(val));
} else if(SValue<SRefAttr<double> > *ref =
dynamic_cast<SValue<SRefAttr<double> >*>(&attr.getBase())) {
} else if((attr.isBaseAllocated() == true) &&
(ref = dynamic_cast<SValue<SRefAttr<double> >*>(&attr.getBase()))) {
const SRefAttr<double> &value = ref->evaluate();
value.set(val);
} else {
......@@ -357,10 +359,11 @@ namespace Attributes {
void setString(Attribute &attr, const std::string &val) {
SValue<SRefAttr<std::string> > *ref;
if(dynamic_cast<const String *>(&attr.getHandler())) {
attr.set(new SValue<std::string>(val));
} else if(SValue<SRefAttr<std::string> > *ref =
dynamic_cast<SValue<SRefAttr<std::string> >*>(&attr.getBase())) {
} else if((attr.isBaseAllocated() == true) &&
(ref = dynamic_cast<SValue<SRefAttr<std::string> >*>(&attr.getBase()))) {
const SRefAttr<std::string> &value = ref->evaluate();
value.set(val);
} else {
......@@ -385,10 +388,11 @@ namespace Attributes {
void setUpperCaseString(Attribute &attr, const std::string &val) {
SValue<SRefAttr<std::string> > *ref;
if(dynamic_cast<const UpperCaseString *>(&attr.getHandler())) {
attr.set(new SValue<std::string>(Util::toUpper(val)));
} else if(SValue<SRefAttr<std::string> > *ref =
dynamic_cast<SValue<SRefAttr<std::string> >*>(&attr.getBase())) {
} else if((attr.isBaseAllocated() == true) &&
(ref = dynamic_cast<SValue<SRefAttr<std::string> >*>(&attr.getBase()))) {
const SRefAttr<std::string> &value = ref->evaluate();
value.set(Util::toUpper(val));
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment