Fix: Avoid CLG_Level warning when -1 is used as CLI parameter
This commit prevents the UBSAN `-fsanitize=enum` warning from being printed when `--log-level -1` is used on the command line. Pull Request: https://projects.blender.org/blender/blender/pulls/143755
This commit is contained in:
@@ -1181,7 +1181,7 @@ static int arg_handle_log_level_set(int argc, const char **argv, void * /*data*/
|
||||
else if (parse_int_clamp(argv[1], nullptr, -1, INT_MAX, &G.log.level, &err_msg)) {
|
||||
/* Numeric level for backwards compatibility. */
|
||||
if (G.log.level < 0) {
|
||||
G.log.level = INT_MAX;
|
||||
G.log.level = CLG_LEVEL_LEN - 1;
|
||||
}
|
||||
else {
|
||||
G.log.level = std::min(CLG_LEVEL_INFO + G.log.level, CLG_LEVEL_LEN - 1);
|
||||
|
||||
Reference in New Issue
Block a user