Skip to content

Commit

Permalink
fix: add nil check for device in whatsapp init
Browse files Browse the repository at this point in the history
fix(init.go): add check for nil device and log error before panic
Ensure proper error handling when no device is found
  • Loading branch information
aldinokemal committed Dec 19, 2024
1 parent 7bf85f7 commit 2868b5b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pkg/whatsapp/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func InitWaCLI(storeContainer *sqlstore.Container) *whatsmeow.Client {
panic(err)
}

if device == nil {
log.Errorf("No device found")
panic("No device found")
}

osName := fmt.Sprintf("%s %s", config.AppOs, config.AppVersion)
store.DeviceProps.PlatformType = &config.AppPlatform
store.DeviceProps.Os = &osName
Expand Down

0 comments on commit 2868b5b

Please sign in to comment.