Skip to content

Commit

Permalink
fix round(5) crash, check type error (#5967)
Browse files Browse the repository at this point in the history
fix round(5) crash, add check type
  • Loading branch information
leaout authored Nov 11, 2024
1 parent b4f83eb commit 6c59b79
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 6c59b79

Please sign in to comment.