Further error proofing

This commit is contained in:
Szymon Porwolik
2025-11-25 20:38:50 +01:00
parent fdda63a0f1
commit a75cf13854
2 changed files with 11 additions and 3 deletions

View File

@@ -745,6 +745,12 @@ $(document).ready(function() {
}
}
// Validate that we have frequency data before proceeding
if (!data.frequency || data.frequency == 0 || data.frequency == null) {
console.warn('CAT: No valid frequency data received');
return;
}
// Force update by clearing catValue (prevents cat2UI from blocking updates)
$frequency.removeData('catValue');
cat_updating_frequency = true; // Set flag before CAT update

View File

@@ -1698,9 +1698,11 @@ $(function() {
if (cachedSpot && cachedSpot.band) {
shouldDecrementTTL = (cachedSpot.band === bandForAPI);
}
} if (shouldDecrementTTL) {
newTTL = ttl - 1; // Decrement only if in scope of this fetch
}
}
if (shouldDecrementTTL) {
newTTL = ttl - 1; // Decrement only if in scope of this fetch
}
if (newSpotKeys.has(key)) {
newTTL = 1; // Reset to 1 if spot still exists (keeps it valid)