Browse Source
fix: handle nil device ID in InitWaCLI function
pull/254/head
almogbaku
1 year ago
No known key found for this signature in database
GPG Key ID: 66C92B1C5B475512
1 changed files with
2 additions and
2 deletions
-
src/pkg/whatsapp/init.go
|
|
@ -75,12 +75,12 @@ func InitWaDB(db_uri string) *sqlstore.Container { |
|
|
|
|
|
|
|
|
func InitWaCLI(storeContainer, keysStoreContainer *sqlstore.Container) *whatsmeow.Client { |
|
|
func InitWaCLI(storeContainer, keysStoreContainer *sqlstore.Container) *whatsmeow.Client { |
|
|
device, err := storeContainer.GetFirstDevice() |
|
|
device, err := storeContainer.GetFirstDevice() |
|
|
if err != nil || device.ID == nil { |
|
|
|
|
|
|
|
|
if err != nil { |
|
|
log.Errorf("Failed to get device: %v", err) |
|
|
log.Errorf("Failed to get device: %v", err) |
|
|
panic(err) |
|
|
panic(err) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if device == nil { |
|
|
|
|
|
|
|
|
if device == nil || device.ID == nil { |
|
|
log.Errorf("No device found") |
|
|
log.Errorf("No device found") |
|
|
panic("No device found") |
|
|
panic("No device found") |
|
|
} |
|
|
} |
|
|
|