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 json
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import time
|
import math
|
||||||
|
import mimetypes
|
||||||
import datetime
|
import datetime
|
||||||
from contextlib import asynccontextmanager
|
from contextlib import asynccontextmanager
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
@@ -1651,11 +1652,13 @@ class WebServer:
|
|||||||
"input_level": (
|
"input_level": (
|
||||||
min(100, round((getattr(pl, '_input_level', 0.0) or 0.0) * 150))
|
min(100, round((getattr(pl, '_input_level', 0.0) or 0.0) * 150))
|
||||||
if pl and isinstance(getattr(pl, '_input_level', None), (int, float))
|
if pl and isinstance(getattr(pl, '_input_level', None), (int, float))
|
||||||
|
and not math.isnan(getattr(pl, '_input_level', 0.0))
|
||||||
else 0
|
else 0
|
||||||
),
|
),
|
||||||
"output_level": (
|
"output_level": (
|
||||||
min(100, round((getattr(pl, '_output_level', 0.0) or 0.0) * 150))
|
min(100, round((getattr(pl, '_output_level', 0.0) or 0.0) * 150))
|
||||||
if pl and isinstance(getattr(pl, '_output_level', None), (int, float))
|
if pl and isinstance(getattr(pl, '_output_level', None), (int, float))
|
||||||
|
and not math.isnan(getattr(pl, '_output_level', 0.0))
|
||||||
else 0
|
else 0
|
||||||
),
|
),
|
||||||
# System stats
|
# System stats
|
||||||
|
|||||||
Reference in New Issue
Block a user