瀏覽代碼

Fix bug where empty txn file causes crash

Daniel Sheffield 3 年之前
父節點
當前提交
38b572c81b
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      widgets.py

+ 4 - 2
widgets.py

@@ -172,8 +172,10 @@ class GroceryTransactionEditor(urwid.WidgetPlaceholder):
                 #print(self.cur.mogrify(line))
                 #input()
                 self.cur.execute(line)
-        self._apply_choice('ts', date)
-        self._apply_choice('store', store)
+        
+            if None not in (date, store):
+                self._apply_choice('ts', date)
+                self._apply_choice('store', store)
 
         self.log = self.open(log)