Browse Source

fix: add nil check for device in whatsapp init

fix(init.go): add check for nil device and log error before panic
Ensure proper error handling when no device is found
pull/221/head
Aldino Kemal 1 year ago
parent
commit
2868b5baba
  1. 5
      src/pkg/whatsapp/init.go

5
src/pkg/whatsapp/init.go

@ -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

Loading…
Cancel
Save