From efd8528db09ad988b9b506e12cee4787588b248c Mon Sep 17 00:00:00 2001 From: Jarno Date: Fri, 19 Dec 2025 14:57:10 +0100 Subject: [PATCH] MultiServer: Safe DataStorage .pop (#5060) * Make datastorage .pop not throw on missing key or index * Reworked to use logic rather than exception catching --- MultiServer.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MultiServer.py b/MultiServer.py index 5e370d1717..d58b466396 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -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: