From 0a6e4358def29952b7355839d3f2288cbebc24c3 Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Tue, 10 Feb 2026 14:22:38 +0000 Subject: [PATCH] fix: wrap setStyleSheet in try/except to prevent stylesheet crash - Add inner try/except around setStyleSheet calls - Catch and ignore stylesheet parsing errors - Prevents 'Could not parse stylesheet' crash --- ui/hud_overlay_clean.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ui/hud_overlay_clean.py b/ui/hud_overlay_clean.py index e2fa11e..99e0161 100644 --- a/ui/hud_overlay_clean.py +++ b/ui/hud_overlay_clean.py @@ -789,7 +789,10 @@ class HUDOverlay(QWidget): profit = self._stats.profit_loss color = "#7FFF7F" if profit >= 0 else "#FF7F7F" self.profit_label.setText(f"{profit:+.2f} PED") - self.profit_label.setStyleSheet(f"font-size: 18px; font-weight: bold; color: {color};") + try: + self.profit_label.setStyleSheet(f"font-size: 18px; font-weight: bold; color: {color};") + except Exception: + pass # Stylesheet error, ignore except RuntimeError: pass @@ -804,7 +807,10 @@ class HUDOverlay(QWidget): else: color = "#FF7F7F" self.return_label.setText(f"{ret:.1f}%") - self.return_label.setStyleSheet(f"font-size: 16px; font-weight: bold; color: {color};") + try: + self.return_label.setStyleSheet(f"font-size: 16px; font-weight: bold; color: {color};") + except Exception: + pass # Stylesheet error, ignore except RuntimeError: pass