fix: handle NaN output_level in state gathering to prevent crash
This commit is contained in:
+4
-1
@@ -15,7 +15,8 @@ import asyncio
|
||||
import json
|
||||
import os
|
||||
import logging
|
||||
import time
|
||||
import math
|
||||
import mimetypes
|
||||
import datetime
|
||||
from contextlib import asynccontextmanager
|
||||
from dataclasses import dataclass, field
|
||||
@@ -1651,11 +1652,13 @@ class WebServer:
|
||||
"input_level": (
|
||||
min(100, round((getattr(pl, '_input_level', 0.0) or 0.0) * 150))
|
||||
if pl and isinstance(getattr(pl, '_input_level', None), (int, float))
|
||||
and not math.isnan(getattr(pl, '_input_level', 0.0))
|
||||
else 0
|
||||
),
|
||||
"output_level": (
|
||||
min(100, round((getattr(pl, '_output_level', 0.0) or 0.0) * 150))
|
||||
if pl and isinstance(getattr(pl, '_output_level', None), (int, float))
|
||||
and not math.isnan(getattr(pl, '_output_level', 0.0))
|
||||
else 0
|
||||
),
|
||||
# System stats
|
||||
|
||||
Reference in New Issue
Block a user