Fix unhandled error with empty clipboard on Win32

This commit is contained in:
Calum Lind 2012-11-16 15:32:49 +00:00
parent 68b413af5f
commit c398ef57a5

View File

@ -626,7 +626,11 @@ class AddTorrentDialog(component.Component):
import win32clipboard as clip
import win32con
clip.OpenClipboard()
text = clip.GetClipboardData(win32con.CF_UNICODETEXT)
try:
text = clip.GetClipboardData(win32con.CF_UNICODETEXT)
except TypeError:
# Catch empty clipboard error
text = ''
clip.CloseClipboard()
else:
clip = gtk.clipboard_get(selection='PRIMARY')