diff options
author | Frederick Yin <fkfd@fkfd.me> | 2021-11-23 16:24:53 +0800 |
---|---|---|
committer | Frederick Yin <fkfd@fkfd.me> | 2021-11-23 16:24:53 +0800 |
commit | 71d7499649a38d11fa3997facab64886a2abe92e (patch) | |
tree | 9bf03150b6ee2bb398de26556beaa7b457d9decb | |
parent | e68c70e2da2d3c84e0accf4a7e85e9dd93029e39 (diff) |
Return 0 if bookmark is not integer
-rw-r--r-- | jimbrella/jform.py | 5 |
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: |