From f6ec57d2a23cabf64eac73b72ad28b9524a9646f Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Mon, 9 Feb 2026 22:01:02 +0000 Subject: [PATCH] fix: better error logging and validation in weapon selector - Add debug logging for skipped weapons - Handle empty strings and 'null' values - Verify all files use correct API attribute names --- ui/weapon_selector.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/weapon_selector.py b/ui/weapon_selector.py index 44524f9..913e9a8 100644 --- a/ui/weapon_selector.py +++ b/ui/weapon_selector.py @@ -113,13 +113,22 @@ class WeaponSelectorDialog(QDialog): try: # Validate that decay and ammo are valid numbers decay_val = w.decay if w.decay is not None else 0 + # NexusWeapon uses ammo_burn, not ammo ammo_val = w.ammo_burn if w.ammo_burn is not None else 0 + + # Additional validation - skip if values are empty strings or 'null' + if decay_val == '' or decay_val == 'null': + decay_val = 0 + if ammo_val == '' or ammo_val == 'null': + ammo_val = 0 + # Try to convert to Decimal to validate Decimal(str(decay_val)) Decimal(str(ammo_val)) self._weapons.append(w) - except (InvalidOperation, ValueError, TypeError): + except (InvalidOperation, ValueError, TypeError) as e: # Skip weapons with invalid data + logger.debug(f"Skipping weapon {getattr(w, 'name', 'unknown')} due to invalid decay/ammo: {e}") continue # Sort by name