diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-10 15:06:57 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-10 15:06:57 +0100 |
commit | 97afa41da38abbf94e17cda0c09ef92cfd9263ee (patch) | |
tree | 4912e98ab77ffe23f81c3ac8f322d86db0af7ace /scene/main | |
parent | 44d5d4e3cde41d6010b784ecc20a891a67c50ac5 (diff) | |
parent | d249370cd7710a927c159e8ff9d60fabf4907792 (diff) |
Merge pull request #73000 from Sauermann/fix-editor-viewport-size-zero-crash
Fix crash in editor when setting `SubViewport.size` to zero
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/viewport.cpp | 5 |
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; |