Fix UnboundLocalError in smartpause plugin (#378)

* Add UnboundLocalError check in smartpause plugin

Running this package for the first time locally, I see the following error in my gnome logs:

```
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]: Exception in thread WorkThread:
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]: Traceback (most recent call last):
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]:   File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]:     self.run()
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]:   File "/usr/lib64/python3.8/threading.py", line 870, in run
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]:     self._target(*self._args, **self._kwargs)
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]:   File "/usr/lib/python3.8/site-packages/safeeyes/plugins/smartpause/plugin.py", line 163, in __start_idle_monitor
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]:     if next_break is not None:
Sep 28 10:31:53 x1carbon safeeyes.desktop[13687]: UnboundLocalError: local variable next_break referenced before assignment
```

This is a quick fix to solve that error

* Set next_break to None before while loop
This commit is contained in:
Chris Coutinho 2020-10-03 13:58:31 +02:00 committed by GitHub
parent 2b0af6e5e2
commit 448e11fe7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -135,6 +135,8 @@ def __start_idle_monitor():
"""
global smart_pause_activated
global idle_start_time
next_break = None
while __is_active():
# Wait for waiting_time seconds
idle_condition.acquire()