From 4779e05f553d9798fae680255d862b4d7145bbbe Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 2 Nov 2018 14:54:13 -0400 Subject: [PATCH] Fix NPE in changing the expiration of a tag --- data/model/tag.py | 2 +- data/model/test/test_tag.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/data/model/tag.py b/data/model/tag.py index d817fb15d..3cd14f298 100644 --- a/data/model/tag.py +++ b/data/model/tag.py @@ -895,7 +895,7 @@ def set_tag_end_ts(tag, end_ts): """ Sets the end timestamp for a tag. Should only be called by change_tag_expiration or tests. """ - end_ms = end_ts * 1000 + end_ms = end_ts * 1000 if end_ts is not None else None with db_transaction(): # Note: We check not just the ID of the tag but also its lifetime_end_ts, to ensure that it has diff --git a/data/model/test/test_tag.py b/data/model/test/test_tag.py index d04ffb96c..731a6d7fe 100644 --- a/data/model/test/test_tag.py +++ b/data/model/test/test_tag.py @@ -209,6 +209,13 @@ def test_list_active_tags(initialized_db): # Make sure they are returned. assert_tags(repository, 'foo', 'bar') + # Set the expirations to be explicitly empty. + set_tag_end_ts(footag, None) + set_tag_end_ts(bartag, None) + + # Make sure they are returned. + assert_tags(repository, 'foo', 'bar') + # Mark as a tag as expiring in the far future, and make sure it is still returned. set_tag_end_ts(footag, footag.lifetime_start_ts + 10000000)