Skip to content

Commit 73b1d73

Browse files
committed
fix(widget): handle JSON decoding errors in CustomWorker
1 parent 6221537 commit 73b1d73

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/core/widgets/yasb/custom.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ def run(self):
2525
proc = subprocess.Popen(self.cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,creationflags=subprocess.CREATE_NO_WINDOW, shell=True)
2626
output = proc.stdout.read()
2727
if self.return_type == "json":
28-
exec_data = json.loads(output)
28+
try:
29+
exec_data = json.loads(output)
30+
except json.JSONDecodeError:
31+
exec_data = None
2932
else:
3033
exec_data = output.decode('utf-8').strip()
3134
self.data_ready.emit(exec_data)

0 commit comments

Comments
 (0)