mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Edit Book: Fix saving of empty files not working
This commit is contained in:
parent
5c2dec8022
commit
77e79d75cb
@ -81,8 +81,11 @@ class PlainTextEdit(QPlainTextEdit):
|
|||||||
if hasattr(ans, 'rstrip'):
|
if hasattr(ans, 'rstrip'):
|
||||||
ans = ans.rstrip('\0')
|
ans = ans.rstrip('\0')
|
||||||
else: # QString
|
else: # QString
|
||||||
while ans[-1] == '\0':
|
try:
|
||||||
ans.chop(1)
|
while ans[-1] == '\0':
|
||||||
|
ans.chop(1)
|
||||||
|
except IndexError:
|
||||||
|
pass # ans is an empty string
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user