From 768cd3ea525bbd1ed2dde5928b0843129274b50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Sun, 26 May 2024 18:46:53 +0200 Subject: [PATCH] core: handle null timers in destructors (#350) --- src/renderer/widgets/Image.cpp | 6 ++++-- src/renderer/widgets/Label.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/renderer/widgets/Image.cpp b/src/renderer/widgets/Image.cpp index f2d475f..f5d1412 100644 --- a/src/renderer/widgets/Image.cpp +++ b/src/renderer/widgets/Image.cpp @@ -5,8 +5,10 @@ #include CImage::~CImage() { - imageTimer->cancel(); - imageTimer.reset(); + if (imageTimer) { + imageTimer->cancel(); + imageTimer.reset(); + } } static void onTimer(std::shared_ptr self, void* data) { diff --git a/src/renderer/widgets/Label.cpp b/src/renderer/widgets/Label.cpp index 11cf82d..79665b9 100644 --- a/src/renderer/widgets/Label.cpp +++ b/src/renderer/widgets/Label.cpp @@ -6,8 +6,10 @@ #include "../../core/hyprlock.hpp" CLabel::~CLabel() { - labelTimer->cancel(); - labelTimer.reset(); + if (labelTimer) { + labelTimer->cancel(); + labelTimer.reset(); + } } static void onTimer(std::shared_ptr self, void* data) {