Skip to content

Commit

Permalink
fix crash on unknown function
Browse files Browse the repository at this point in the history
  • Loading branch information
anatom3000 committed Oct 30, 2024
1 parent 425b035 commit ae0705d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ struct Expr {
case 0: {
if (this->name == "random") {
return double(std::rand()) / double(RAND_MAX);
}
} else return NAN;

}
case 1: {
Expand Down Expand Up @@ -217,7 +217,7 @@ struct Expr {
} else {
return -1.0;
}
}
} else return NAN;
}
case 2: {
double arg1 = this->args[0].interpret(c);
Expand All @@ -227,6 +227,7 @@ struct Expr {

if (this->name == "min") return std::min(arg1, arg2);
else if (this->name == "max") return std::max(arg1, arg2);
else return NAN;
}
default: return NAN;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ class FunctionToolPopup : public geode::Popup<> {
}

void onClose(CCObject* sender) override {
Mod::get()->saveData();
(void)Mod::get()->saveData();
Popup::onClose(sender);
}
};
Expand Down

0 comments on commit ae0705d

Please sign in to comment.