From 1855b2cfa7ab54c9bdfdfc84154333078e553c33 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Tue, 19 Sep 2023 15:49:27 +0200 Subject: [PATCH] fix min color width to 1 (prevent div by 0) --- libsrc/visualization/vsmesh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/visualization/vsmesh.cpp b/libsrc/visualization/vsmesh.cpp index b8aa8509..a66cd541 100644 --- a/libsrc/visualization/vsmesh.cpp +++ b/libsrc/visualization/vsmesh.cpp @@ -904,7 +904,7 @@ namespace netgen data.Append(cf); } int n = data.Size()/4; - colors.width = min2(n, 1024); + colors.width = max2(1,min2(n, 1024)); colors.height = (n+colors.width-1)/colors.width; for([[maybe_unused]] auto i: Range(n, colors.width*colors.height)) data.Append({0.0f, 0.0f, 0.0f, 0.0f});