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
This commit is contained in:
parent
b14888dc97
commit
0a6e4358de
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue