From 195606caeb39ad1c3625f9633c093d34cd1169bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Pereira?= Date: Tue, 17 Oct 2023 22:29:10 +0100 Subject: [PATCH] Avoid null pointer dereference If w is nullptr we must not dereference it. qFatal is a cleaner solution. --- src/termwidgetholder.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/termwidgetholder.cpp b/src/termwidgetholder.cpp index aa7df472..95c556c4 100644 --- a/src/termwidgetholder.cpp +++ b/src/termwidgetholder.cpp @@ -397,10 +397,9 @@ void TermWidgetHolder::setCurrentTerminal(TermWidget* term) void TermWidgetHolder::handle_finished() { TermWidget * w = qobject_cast(sender()); - if (!w) + if (w == nullptr) { - qDebug() << "TermWidgetHolder::handle_finished: Unknown object to handle" << w; - assert(0); + qFatal("TermWidgetHolder::handle_finished: Unknown object to handle"); } splitCollapse(w); }