Fixed error string from userdata return values not persisting long enough.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f8cbe502c9
commit
a32b76d904
|
@ -6,7 +6,7 @@ extern "C"{
|
||||||
}
|
}
|
||||||
|
|
||||||
Porygon::UserData::UserDataReturnValue* ErrorValue(const char* message){
|
Porygon::UserData::UserDataReturnValue* ErrorValue(const char* message){
|
||||||
return new Porygon::UserData::UserDataReturnValue(message);
|
return new Porygon::UserData::UserDataReturnValue(string(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,13 +8,17 @@ namespace Porygon::UserData {
|
||||||
struct UserDataReturnValue {
|
struct UserDataReturnValue {
|
||||||
bool _success;
|
bool _success;
|
||||||
union {
|
union {
|
||||||
const char *_message;
|
string _message;
|
||||||
const Evaluation::EvalValue *_value;
|
const Evaluation::EvalValue *_value;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
UserDataReturnValue(Evaluation::EvalValue *value) : _success(true), _value(value) {}
|
UserDataReturnValue(Evaluation::EvalValue *value) : _success(true), _value(value) {}
|
||||||
UserDataReturnValue(const Evaluation::EvalValue *value) : _success(true), _value(value) {}
|
UserDataReturnValue(const Evaluation::EvalValue *value) : _success(true), _value(value) {}
|
||||||
UserDataReturnValue(const char *message) : _success(false), _message(message) {}
|
UserDataReturnValue(string message) : _success(false), _message(message) {}
|
||||||
|
|
||||||
|
~UserDataReturnValue(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
inline const Evaluation::EvalValue *Evaluate() const{
|
inline const Evaluation::EvalValue *Evaluate() const{
|
||||||
if (_success) {
|
if (_success) {
|
||||||
|
|
Loading…
Reference in New Issue