Fixed a bug that would crash Fenrir if the clipboard was empty on export to file.

This commit is contained in:
Storm Dragon 2021-06-08 14:23:04 -04:00
parent 7cadae70b6
commit 399f021475

View File

@ -162,7 +162,11 @@ class remoteManager():
self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True) self.env['runtime']['outputManager'].presentText(_('clipboard empty'), interrupt=True)
return return
clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory')
clipboardFile.write(clipboard) # Fenrir will crash if the clipboard variable is type None
if clipboard is not None:
clipboardFile.write(clipboard)
else:
clipboardFile.write('')
clipboardFile.close() clipboardFile.close()
os.chmod(clipboardFilePath, 0o666) os.chmod(clipboardFilePath, 0o666)
self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True) self.env['runtime']['outputManager'].presentText(_('clipboard exported to file'), interrupt=True)