From 2a1e3840340070e8e3d52a42498e7862432100c5 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sat, 24 Mar 2018 18:50:27 -0700 Subject: [PATCH] handle new empty database on startup --- pnut-bridge.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pnut-bridge.py b/pnut-bridge.py index 0506060..c313805 100644 --- a/pnut-bridge.py +++ b/pnut-bridge.py @@ -185,7 +185,8 @@ class ChannelMonitor(threading.Thread): logging.info("-- Starting channel monitor --") app.app_context().push() rooms = MatrixRoom2.query.all() - self.txId = int(rooms[0].pnut_since) + if rooms: + self.txId = int(rooms[0].pnut_since) while not _shutdown.isSet(): rooms = MatrixRoom2.query.all() for r in rooms: