syncthing-android icon indicating copy to clipboard operation
syncthing-android copied to clipboard

selecting a Folder for File Versioning crashes

Open steelbytes opened this issue 1 year ago • 6 comments

trying to select a Folder for File Versioning in the android native ui crashes.

Android 13 on Pixel 7Pro

05-27 11:29:49.423 13348 13348 E AndroidRuntime: FATAL EXCEPTION: main
05-27 11:29:49.423 13348 13348 E AndroidRuntime: Process: com.nutomic.syncthingandroid, PID: 13348
05-27 11:29:49.423 13348 13348 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nutomic.syncthingandroid/com.nutomic.syncthingandroid.activities.FolderPickerActivity}: java.lang.NullPointerException: Attempt to get length of null array
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3641)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3778)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:138)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2303)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:201)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:288)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7884)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
05-27 11:29:49.423 13348 13348 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to get length of null array
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at java.util.Collections.addAll(Collections.java:5457)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at com.nutomic.syncthingandroid.activities.FolderPickerActivity.populateRoots(FolderPickerActivity.java:142)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at com.nutomic.syncthingandroid.activities.FolderPickerActivity.onCreate(FolderPickerActivity.java:98)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:8341)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.Activity.performCreate(Activity.java:8320)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3622)
05-27 11:29:49.423 13348 13348 E AndroidRuntime:        ... 12 more

steelbytes avatar May 27 '23 01:05 steelbytes

Which app version?

imsodin avatar May 27 '23 17:05 imsodin

Which app version?

1.23.4 (current) from PlayStore

steelbytes avatar Jun 04 '23 23:06 steelbytes

Just got this too, I'm brand new to Syncthing as of this evening.

On phone I have Syncthing 1.23.5 from f-droid.

On (linux) desktop I have Syncthing 1.23.6.

On desktop I changed a remote shared folder "Redmi Note Pro 5 - Call Logs Backup & Restore (RO)" setting to 'Simple File Versioning'. The phone disconnected and Syncthing on the phone starts crashing over and over.

The desktop popped up this message:

Screenshot at 2023-07-11 23-36-56

update: while I'm certain adding folder versioning triggered this problem, removing the shared folders on both ends and re-adding them without versioning appears to have fixed the crashing. I've had syncthing running stably for two weeks now. I might try adding versioning again to see if I can replicate this.

update 2: yup, enabling simple file versioning triggers this. It's back to crashing endlessly again. Grr.

lsh-0 avatar Jul 11 '23 14:07 lsh-0

so .... no fix?

steelbytes avatar Sep 22 '23 08:09 steelbytes

Going after the error message;

Collections.addAll(roots, new File("/storage/").listFiles()); seems to be the trigger. And I do know that .listFiles() can return null if the supplied abstract path is not accessible or a valid directory, which can easily trigger this. And also that accessing /storage/ is tricky - so the solution may be double-folded.

er-pa avatar Sep 22 '23 09:09 er-pa

Happy to help if I can. Even without file versioning turned on syncthing is fantastic tool.

lsh-0 avatar Sep 22 '23 09:09 lsh-0