summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-02-09 23:14:46 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2023-02-10 00:25:45 +0100
commitd249370cd7710a927c159e8ff9d60fabf4907792 (patch)
tree37df9e19e6cb6f0164a122c9fc53a6d3abe6c1ad /scene/main
parent5c1295dc20323ee1596369b5bcf91ba6a9383336 (diff)
Fix crash in editor when setting `SubViewport.size` to zero
`Viewport::_set_size` now verifies, that the minimum size is at least 2x2. Also fix `RendererViewport::viewport_set_size` fail condition.
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/viewport.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index a1e7555a5d..23b7c072be 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -823,11 +823,12 @@ void Viewport::_set_size(const Size2i &p_size, const Size2i &p_size_2d_override,
stretch_transform_new.scale(scale);
}
- if (size == p_size && size_allocated == p_allocated && stretch_transform == stretch_transform_new && p_size_2d_override == size_2d_override) {
+ Size2i new_size = p_size.max(Size2i(2, 2));
+ if (size == new_size && size_allocated == p_allocated && stretch_transform == stretch_transform_new && p_size_2d_override == size_2d_override) {
return;
}
- size = p_size;
+ size = new_size;
size_allocated = p_allocated;
size_2d_override = p_size_2d_override;
stretch_transform = stretch_transform_new;