From 71d7499649a38d11fa3997facab64886a2abe92e Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Tue, 23 Nov 2021 16:24:53 +0800 Subject: Return 0 if bookmark is not integer --- jimbrella/jform.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jimbrella/jform.py b/jimbrella/jform.py index de2c508..e9f2a50 100644 --- a/jimbrella/jform.py +++ b/jimbrella/jform.py @@ -51,7 +51,10 @@ class JForm: with open(self._bookmark_fp) as f: bookmark = f.read() f.close() - return int(bookmark) + try: + return int(bookmark) + except ValueError: + return 0 except FileNotFoundError: # create file with open(self._bookmark_fp, "x") as f: -- cgit v1.2.3