question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception when saving

See original GitHub issue

gallery_saver: ^2.2.0 compileSdkVersion 30 targetSdkVersion 30

Fatal Exception: java.lang.NullPointerException
       at carnegietechnologies.gallery_saver.GallerySaver.finishWithSuccess(GallerySaver.kt:77)
       at carnegietechnologies.gallery_saver.GallerySaver.access$finishWithSuccess(GallerySaver.kt:16)
       at carnegietechnologies.gallery_saver.GallerySaver$saveMediaFile$1.invokeSuspend(GallerySaver.kt:72)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:236)
       at android.app.ActivityThread.main(ActivityThread.java:7864)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:620)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1011)

can’t reproduce on my device but i can see many exceptions like this in crashlytics… any idea? thanks!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
carlosfioricommented, Dec 23, 2021

Same here, but with pictures. If I try to save multiple images in sync they work fine. But if it’s in parallel, it crashes the app.

Works:

 
static Future<List<bool?>> downloadAllImages(List<String> urls) async {
  final distinctUrls = urls.toSet().toList();

  final results = <bool?>[];
  for (var url in distinctUrls) {
    final result = await GallerySaver.saveImage(url);
    results.add(result);
  }
  return results;
 }

Crashs the app:

static Future<List<bool?>> downloadAllImages(List<String> urls) async {
  final distinctUrls = urls.toSet().toList();

  return Future.wait(distinctUrls.map(GallerySaver.saveImage));
}
E/AndroidRuntime( 7464): java.lang.NullPointerException
E/AndroidRuntime( 7464): 	at carnegietechnologies.gallery_saver.GallerySaver.finishWithSuccess(GallerySaver.kt:79)
E/AndroidRuntime( 7464): 	at carnegietechnologies.gallery_saver.GallerySaver.access$finishWithSuccess(GallerySaver.kt:16)
E/AndroidRuntime( 7464): 	at carnegietechnologies.gallery_saver.GallerySaver$saveMediaFile$1.invokeSuspend(GallerySaver.kt:74)
E/AndroidRuntime( 7464): 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime( 7464): 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
E/AndroidRuntime( 7464): 	at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime( 7464): 	at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime( 7464): 	at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 7464): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 7464): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 7464): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 7464): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process ( 7464): Sending signal. PID: 7464 SIG: 9
Lost connection to device.
0reactions
rensviscommented, Jan 5, 2022

I have exactly the same behavior as @carlosfiori. Would be great if there was a method that took a list of paths/urls.

Read more comments on GitHub >

github_iconTop Results From Across the Web

repository.save() throwing the wrong exception - java
I am using a jpa repository that extends from CrudRepository to save an object into a DB.
Read more >
Exception vs Saving - What's the difference? - WikiDiff |
As nouns the difference between exception and saving is that exception is the act of excepting or excluding; exclusion; restriction by taking out...
Read more >
Random Exception when saving an ASPX file Exception from ...
I had opened my solution in VS 2019 and made a few changes to an aspx file by copying text from a JIRA...
Read more >
"Unable to save configuration due to an unknown exception ...
This can occur when one or more of the files in the $IMPACT_HOME/uiproviderconfig/properties directory are missing newlines and multiple ...
Read more >
Catching exception when saving records
Catching exception when saving records ... -need to catch error for record locked. ... for #1 I am not using visualforce so I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found