summaryrefslogtreecommitdiff
path: root/jimbrella/jform.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2021-11-23 16:24:53 +0800
committerFrederick Yin <fkfd@fkfd.me>2021-11-23 16:24:53 +0800
commit71d7499649a38d11fa3997facab64886a2abe92e (patch)
tree9bf03150b6ee2bb398de26556beaa7b457d9decb /jimbrella/jform.py
parente68c70e2da2d3c84e0accf4a7e85e9dd93029e39 (diff)
Return 0 if bookmark is not integer
Diffstat (limited to 'jimbrella/jform.py')
-rw-r--r--jimbrella/jform.py5
1 files changed, 4 insertions, 1 deletions
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: