From 31bc85a5fd16fa0472bdfd69ebd1029ff844f9bd Mon Sep 17 00:00:00 2001 From: Heapnotizer Date: Sun, 5 Oct 2025 14:29:02 +0530 Subject: [PATCH 1/3] Fix index out of bound crash --- src/ui/tools/tweak-tool.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 0dd3b4f316..fa1e593cc2 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -304,10 +304,12 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P std::vector to_select; SPDocument *doc = item->document; sp_item_list_to_curves (items, selected, to_select); - SPObject* newObj = doc->getObjectByRepr(to_select[0]); - item = cast(newObj); - g_assert(item != nullptr); - selection->add(item); + if(to_select.size() > 0) { + SPObject* newObj = doc->getObjectByRepr(to_select[0]); + item = cast(newObj); + g_assert(item != nullptr); + selection->add(item); + } } if (is(item) && !is(item)) { -- GitLab From d33e7a7caa3ab817db0e7e41394705e7a441f6cc Mon Sep 17 00:00:00 2001 From: Heapnotizer Date: Sun, 5 Oct 2025 18:18:03 +0530 Subject: [PATCH 2/3] Fix formatting --- src/ui/tools/tweak-tool.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index fa1e593cc2..57bae42e5e 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -304,8 +304,8 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P std::vector to_select; SPDocument *doc = item->document; sp_item_list_to_curves (items, selected, to_select); - if(to_select.size() > 0) { - SPObject* newObj = doc->getObjectByRepr(to_select[0]); + if (to_select.size() > 0) { + SPObject *newObj = doc->getObjectByRepr(to_select[0]); item = cast(newObj); g_assert(item != nullptr); selection->add(item); -- GitLab From f6450d14e41620551f13b4652ca923de903009df Mon Sep 17 00:00:00 2001 From: Heapnotizer Date: Sun, 5 Oct 2025 18:52:19 +0530 Subject: [PATCH 3/3] Update size check with empty function Fixes: https://gitlab.com/inkscape/inkscape/-/issues/5918 --- src/ui/tools/tweak-tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index 57bae42e5e..e20f73f417 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -304,7 +304,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P std::vector to_select; SPDocument *doc = item->document; sp_item_list_to_curves (items, selected, to_select); - if (to_select.size() > 0) { + if (!to_select.empty()) { SPObject *newObj = doc->getObjectByRepr(to_select[0]); item = cast(newObj); g_assert(item != nullptr); -- GitLab