From fd90e1060055af4c08cdba4ce263844012420085 Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Tue, 4 Jan 2022 17:27:07 +0100 Subject: [PATCH] PixelPaint: Fix crash on applying with no filter selected The wrong conception that done() would stop the program flow right there lead to the lambda not properly aborting when no filter was selected. The ExecAborted would be processed and then the nullptr that was m_selected_filter would be happily dereferenced. This patch fixes that. --- Userland/Applications/PixelPaint/FilterGallery.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Applications/PixelPaint/FilterGallery.cpp b/Userland/Applications/PixelPaint/FilterGallery.cpp index bdbfd27e6f..325e40b940 100644 --- a/Userland/Applications/PixelPaint/FilterGallery.cpp +++ b/Userland/Applications/PixelPaint/FilterGallery.cpp @@ -56,8 +56,10 @@ FilterGallery::FilterGallery(GUI::Window* parent_window, ImageEditor* editor) }; apply_button->on_click = [this](auto) { - if (!m_selected_filter) + if (!m_selected_filter) { done(ExecResult::ExecAborted); + return; + } m_selected_filter->apply(); done(ExecResult::ExecOK);