Skip to content

Commit d6ff994

Browse files
committed
Error handling for restore_window
1 parent c68f4c5 commit d6ff994

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

castervoice/lib/utilities.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,14 @@ def minimize_window():
8585
Window.get_foreground().minimize()
8686

8787
def restore_window():
88+
'''
89+
Restores last minimized window triggered minimize_window.
90+
'''
8891
global lasthandle
89-
Window.restore(lasthandle)
92+
if lasthandle is None:
93+
printer.out("No previous window minimized by voice")
94+
else:
95+
Window.restore(lasthandle)
9096

9197
def get_active_window_info():
9298
'''Returns foreground window executable_file, executable_path, title, handle, classname'''

0 commit comments

Comments
 (0)