From e8f899d098a67eb796fc8034e8dde0ce50f99c90 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Sat, 23 May 2026 01:02:32 +0000 Subject: [PATCH] Don't bonk when we have no E164s --- db/query/comms/phone.go | 3 +++ platform/publicreport/contact.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/db/query/comms/phone.go b/db/query/comms/phone.go index a4c91954..6482bf49 100644 --- a/db/query/comms/phone.go +++ b/db/query/comms/phone.go @@ -41,6 +41,9 @@ func PhoneFromE164(ctx context.Context, txn db.Ex, e164 string) (model.Phone, er return db.ExecuteOneTx[model.Phone](ctx, txn, statement) } func PhonesFromE164s(ctx context.Context, txn db.Ex, e164s []string) ([]model.Phone, error) { + if len(e164s) == 0 { + return []model.Phone{}, nil + } sql_ids := make([]postgres.Expression, len(e164s)) for i, e164 := range e164s { sql_ids[i] = postgres.String(e164) diff --git a/platform/publicreport/contact.go b/platform/publicreport/contact.go index 60ec2173..3aca8fab 100644 --- a/platform/publicreport/contact.go +++ b/platform/publicreport/contact.go @@ -21,7 +21,7 @@ func ContactSimplesFromIDs(ctx context.Context, txn db.Ex, contact_ids []int64) } contact_phones, err := querycomms.ContactPhoneByContactIDs(ctx, txn, contact_ids) if err != nil { - return nil, fmt.Errorf("contact phones from ids: %w", err) + return nil, fmt.Errorf("contact phone by contact ids: %w", err) } e164s := make([]string, 0) for _, v := range contact_phones {