Skip to content

Commit

Permalink
fix round(5) crash, add check type
Browse files Browse the repository at this point in the history
  • Loading branch information
leaout committed Nov 8, 2024
1 parent b4f83eb commit 70edf16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common/function/FunctionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,12 @@ FunctionManager::FunctionManager() {
return Value::kNullBadType;
}
}
return std::round(args[0].get().getFloat());
if (args[0].get().type() == Value::Type::INT) {
return std::round(args[0].get().getInt());
} else if (args[0].get().type() == Value::Type::FLOAT) {
return std::round(args[0].get().getFloat());
}
return Value::kNullBadType;
}
default: {
return Value::kNullBadType;
Expand Down

0 comments on commit 70edf16

Please sign in to comment.