From 9d2db1d95338f9c69a41005e3cac940516212b07 Mon Sep 17 00:00:00 2001 From: Martin Hutchinson Date: Mon, 2 Dec 2024 15:24:24 +0000 Subject: [PATCH] Fail with error instead of panic This could happen if the wrong verifier key was provided. --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 655fe04..57a26b2 100644 --- a/main.go +++ b/main.go @@ -131,8 +131,11 @@ func (c *Controller) SelectLog(o string) { func (c *Controller) InitFromLog() { c.RefreshCheckpoint() - if c.Model.GetCheckpoint() != nil && c.Model.GetCheckpoint().Size > 0 { - size := c.Model.GetCheckpoint().Size + if err := c.Model.GetError(); err != nil { + klog.Exit(err) + } + if cp := c.Model.GetCheckpoint(); cp != nil && cp.Size > 0 { + size := cp.Size c.GetLeaf(size, size-1) } }