aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2022-05-30 18:17:28 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2022-05-30 18:17:28 +0200
commit1fad16fce06207eda5861559f4b6c908ee048712 (patch)
tree0b6eb1ef7ce7ea8f9a8c95d6277213e1941b8648 /src/script
parent9fc018ded10225589d2559d24a5db739e891fb31 (diff)
downloadminetest-clamp.tar.xz
Invalid float vector dimension range: clamp and warn instead of crashclamp
Diffstat (limited to 'src/script')
-rw-r--r--src/script/common/c_converter.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/script/common/c_converter.cpp b/src/script/common/c_converter.cpp
index b5ff52f73..351121abf 100644
--- a/src/script/common/c_converter.cpp
+++ b/src/script/common/c_converter.cpp
@@ -42,11 +42,13 @@ extern "C" {
#define CHECK_POS_COORD(name) CHECK_TYPE(-1, "position coordinate '" name "'", LUA_TNUMBER)
#define CHECK_FLOAT_RANGE(value, name) \
if (value < F1000_MIN || value > F1000_MAX) { \
- std::ostringstream error_text; \
- error_text << "Invalid float vector dimension range '" name "' " << \
+ warningstream << "Invalid float vector dimension range '" name "' " << \
"(expected " << F1000_MIN << " < " name " < " << F1000_MAX << \
" got " << value << ")." << std::endl; \
- throw LuaError(error_text.str()); \
+ if (value < F1000_MIN) \
+ value = F1000_MIN; \
+ else \
+ value = F1000_MAX; \
}
#define CHECK_POS_TAB(index) CHECK_TYPE(index, "position", LUA_TTABLE)