MultiServer: Safe DataStorage .pop (#5060)

* Make datastorage .pop not throw on missing key or index

* Reworked to use logic rather than exception catching
This commit is contained in:
Jarno
2025-12-19 14:57:10 +01:00
committed by GitHub
parent e54a15978f
commit efd8528db0

View File

@@ -69,6 +69,12 @@ def remove_from_list(container, value):
def pop_from_container(container, value):
if isinstance(container, list) and isinstance(value, int) and len(container) <= value:
return container
if isinstance(container, dict) and value not in container:
return container
try:
container.pop(value)
except ValueError: