Skip to content

Commit

Permalink
fix(widget): handle JSON decoding errors in CustomWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
amnweb committed Jan 15, 2025
1 parent 6221537 commit 73b1d73
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/widgets/yasb/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def run(self):
proc = subprocess.Popen(self.cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,creationflags=subprocess.CREATE_NO_WINDOW, shell=True)
output = proc.stdout.read()
if self.return_type == "json":
exec_data = json.loads(output)
try:
exec_data = json.loads(output)
except json.JSONDecodeError:
exec_data = None
else:
exec_data = output.decode('utf-8').strip()
self.data_ready.emit(exec_data)
Expand Down

0 comments on commit 73b1d73

Please sign in to comment.