nextcloud / nextcloud/notes-android

NPE when opening note from widget: `NoteDirectEditFragment.getBinding`

Open
#1,937 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Editor::Direct Widget :: Single Note
Dominant language
Java
Stars
1.1k
Forks
168
Avg merge
1d 17h
Merged PRs (30d)
31

Description

Describe the bug

The apps throws an error when opening a note from a widget.

To Reproduce
Steps to reproduce the behavior:

  1. Add a widget with a note
  2. open the note from the widget

It is kind of random though.

Expected behavior

The note to open.

Screenshots

Smartphone (please complete the following information):

  • Nextcloud Notes-Version (android app):
  • F-Droid or Play Store: f-droid
  • Android-Version: 12
  • Device: Xiaomi Redmi note 9 pro

Server

  • Nextcloud version: 27.1.4
  • Nextcloud Notes version (server app): 4.1.0

Stacktrace

App Version: 4.1.0
App Version Code: 40010090
App Flavor: fdroid

Files App Version Code: 30260090 (PROD)

---

OS Version: 4.14.190-perf-ge5736035ab68(V14.0.5.0.SJZEUXM)
OS API Level: 31
Device: joyeuse
Manufacturer: Xiaomi
Model (and Product): Redmi Note 9 Pro (joyeuse_eea)

---

java.lang.NullPointerException
	at it.niedermann.owncloud.notes.edit.NoteDirectEditFragment.getBinding(NoteDirectEditFragment.kt:46)
	at it.niedermann.owncloud.notes.edit.NoteDirectEditFragment.access$getBinding(NoteDirectEditFragment.kt:43)
	at it.niedermann.owncloud.notes.edit.NoteDirectEditFragment$loadNoteInWebView$urlDisposable$1.invoke(NoteDirectEditFragment.kt:182)
	at it.niedermann.owncloud.notes.edit.NoteDirectEditFragment$loadNoteInWebView$urlDisposable$1.invoke(NoteDirectEditFragment.kt:178)
	at it.niedermann.owncloud.notes.edit.NoteDirectEditFragment.loadNoteInWebView$lambda$8(NoteDirectEditFragment.kt:178)
	at it.niedermann.owncloud.notes.edit.NoteDirectEditFragment.$r8$lambda$kUuMVzu4H1bdi2T8u3NABhyKb5I(Unknown Source:0)
	at it.niedermann.owncloud.notes.edit.NoteDirectEditFragment$$ExternalSyntheticLambda8.accept(Unknown Source:2)
	at io.reactivex.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
	at io.reactivex.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
	at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:210)
	at android.os.Looper.loop(Looper.java:299)
	at android.app.ActivityThread.main(ActivityThread.java:8319)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with NoteDirectEditFragment.kt, especially getBinding at line 46 and loadNoteInWebView around line 182. Reproduce opening a widget note on the reported Android setup and trace whether the fragment remains available when the asynchronous load completes; done means the note opens without the reported NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.