From f902f25d7275e5a16dbf6f1c67025e241af91e38 Mon Sep 17 00:00:00 2001 From: Mark Pashmfouroush Date: Tue, 2 Apr 2024 04:34:57 +0100 Subject: [PATCH] warp: fix crash when attempting to load old identity When the old identity is encountered, just recreate. Signed-off-by: Mark Pashmfouroush --- warp/account.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/warp/account.go b/warp/account.go index 16d4a5ce0..8b6443a7f 100644 --- a/warp/account.go +++ b/warp/account.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "io" "log/slog" @@ -355,6 +356,10 @@ func LoadIdentity(path string) (Identity, error) { return Identity{}, err } + if len(i.Config.Peers) < 1 { + return Identity{}, errors.New("identity contains 0 peers") + } + return *i, nil }