You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am using this plugin in one of my projects and the issue is that whenever i call OneSignal.shared.getTags method in my flutter code it gives me null pointer exception. Note that for the first time when the device get registered on one signal there are no tags on onesignal with that device unless you send a tag for the first time. Now in my project every time I have to get old tags from one signal and then delete old tags and then add new tags on one signal. The problem in short that if there are no tags on one signal and you try to call OneSignal.shared.getTags method then you will get a null pointer exception.
Environment
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.7.3, on Mac OS X 10.13.5 17F77, locale en-OM)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3.1)
[✓] Android Studio (version 3.1)
[!] VS Code (version 1.26.1)
[✓] Connected devices (1 available)
! Doctor found issues in 1 category.
One signal plugin version in pubspec.yaml
onesignal: ^1.0.1
Also: I ran the app on android emulator Nexus 4 API 27
Steps to Reproduce Issue:
Setup a new basic flutter project
Register a device on onesignal with OneSignal.shared.init method
try to call OneSignal.shared.getTags method
Anything else:
I think that there is a problem with com.onesignal.flutter.OneSignalSerializer.convertJSONObjectToHashMap method as there is no check on null object If object is null it should not call object.keys().
Or Maybe I am wrong there is some problem with my code. I don't know.
Stack Trace
09-10 15:02:54.970 31812-31910/com.example.app E/AndroidRuntime: FATAL EXCEPTION: OS_GETTAGS_CALLBACK
Process: com.example.app, PID: 31812
java.lang.NullPointerException: Attempt to invoke virtual method
'java.util.Iterator org.json.JSONObject.keys()' on a null object reference at com.onesignal.flutter.OneSignalSerializer.convertJSONObjectToHashMap(OneSignalSerializer.java:202) at com.onesignal.flutter.OSFlutterChangeTagsHandler.tagsAvailable(OneSignalTagsController.java:63) at com.onesignal.OneSignal$14.run(OneSignal.java:1653) at java.lang.Thread.run(Thread.java:764)
The text was updated successfully, but these errors were encountered:
Description:
Hello, I am using this plugin in one of my projects and the issue is that whenever i call OneSignal.shared.getTags method in my flutter code it gives me null pointer exception. Note that for the first time when the device get registered on one signal there are no tags on onesignal with that device unless you send a tag for the first time. Now in my project every time I have to get old tags from one signal and then delete old tags and then add new tags on one signal. The problem in short that if there are no tags on one signal and you try to call OneSignal.shared.getTags method then you will get a null pointer exception.
Environment
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.7.3, on Mac OS X 10.13.5 17F77, locale en-OM)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.3.1)
[✓] Android Studio (version 3.1)
[!] VS Code (version 1.26.1)
[✓] Connected devices (1 available)
! Doctor found issues in 1 category.
One signal plugin version in pubspec.yaml
onesignal: ^1.0.1
Also: I ran the app on android emulator Nexus 4 API 27
Steps to Reproduce Issue:
Anything else:
I think that there is a problem with com.onesignal.flutter.OneSignalSerializer.convertJSONObjectToHashMap method as there is no check on null object If object is null it should not call object.keys().
Or Maybe I am wrong there is some problem with my code. I don't know.
Stack Trace
09-10 15:02:54.970 31812-31910/com.example.app E/AndroidRuntime: FATAL EXCEPTION: OS_GETTAGS_CALLBACK
Process: com.example.app, PID: 31812
java.lang.NullPointerException: Attempt to invoke virtual method
'java.util.Iterator org.json.JSONObject.keys()' on a null object reference at com.onesignal.flutter.OneSignalSerializer.convertJSONObjectToHashMap(OneSignalSerializer.java:202) at com.onesignal.flutter.OSFlutterChangeTagsHandler.tagsAvailable(OneSignalTagsController.java:63) at com.onesignal.OneSignal$14.run(OneSignal.java:1653) at java.lang.Thread.run(Thread.java:764)
The text was updated successfully, but these errors were encountered: