Skip to content

Commit

Permalink
Avoid null pointer dereference
Browse files Browse the repository at this point in the history
If w is nullptr we must not dereference it.
qFatal is a cleaner solution.
  • Loading branch information
luis-pereira committed Oct 17, 2023
1 parent 7100d5a commit 195606c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/termwidgetholder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,9 @@ void TermWidgetHolder::setCurrentTerminal(TermWidget* term)
void TermWidgetHolder::handle_finished()
{
TermWidget * w = qobject_cast<TermWidget*>(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);
}
Expand Down

0 comments on commit 195606c

Please sign in to comment.