From dfb1d80baf2559b2d0f811a227a3aafe0f6a655b Mon Sep 17 00:00:00 2001 From: Wout Slakhorst Date: Wed, 15 May 2024 11:05:37 +0200 Subject: [PATCH] prevent panic (#3118) --- discovery/store.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/discovery/store.go b/discovery/store.go index 428fe55b67..c56ace30e5 100644 --- a/discovery/store.go +++ b/discovery/store.go @@ -122,12 +122,15 @@ func (s *sqlStore) add(serviceID string, presentation vc.VerifiablePresentation, if timestamp == 0 { var newTs *int newTs, err = s.incrementTimestamp(tx, serviceID) + if err != nil { + return err + } timestamp = *newTs } else { err = s.setTimestamp(tx, serviceID, timestamp) - } - if err != nil { - return err + if err != nil { + return err + } } // Delete any previous presentations of the subject if err := tx.Delete(&presentationRecord{}, "service_id = ? AND credential_subject_id = ?", serviceID, credentialSubjectID.String()).