Skip to content

Commit

Permalink
fix error when time is None
Browse files Browse the repository at this point in the history
  • Loading branch information
Evidlo committed Jun 5, 2023
1 parent f3da333 commit 2f63ad8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
12 changes: 9 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
4.0.4 -
4.0.5 -
------------------
- fixed #344 - AttributeError when accessing Times with None value
- use __hash__ when evaluating equality
- use mtime/uuid for HistoryEntry hashing

4.0.4 - 2023-05-23
------------------
- fixed #314 - correctly handle binaries with no data
- fixed #265 - check for keepass signature
Expand All @@ -10,8 +16,8 @@

4.0.3 - 2022-06-21
------------------
- add otp support
- add debug_setup() function
- added otp support
- added debug_setup() function

4.0.2 - 2022-05-21
------------------
Expand Down
2 changes: 1 addition & 1 deletion pykeepass/baseelement.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _get_times_property(self, prop):
times = self._element.find('Times')
if times is not None:
prop = times.find(prop)
if prop is not None:
if prop is not None and prop.text is not None:
return self._kp._decode_time(prop.text)

def _set_times_property(self, prop, value):
Expand Down
Binary file modified tests/test3.kdbx
Binary file not shown.
Binary file modified tests/test4.kdbx
Binary file not shown.
5 changes: 5 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,11 @@ def test_issue308(self):

self.assertEqual(results, results2)

def test_issue344(self):
# accessing expiry_time throws exception when None

e = self.kp.find_entries(title='none_date', first=True)
self.assertEqual(e.expiry_time, None)

class EntryFindTests4(KDBX4Tests, EntryFindTests3):
pass
Expand Down

0 comments on commit 2f63ad8

Please sign in to comment.