Skip to content

Commit f5bd9fa

Browse files
committed
onNoteLoaded npe checks
Signed-off-by: alperozturk <[email protected]>
1 parent c146f14 commit f5bd9fa

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/src/main/java/it/niedermann/owncloud/notes/edit/NoteDirectEditFragment.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,13 @@ class NoteDirectEditFragment : BaseNoteFragment(), Branded {
148148
disposables.add(timeoutDisposable)
149149
}
150150

151-
override fun onNoteLoaded(note: Note) {
151+
override fun onNoteLoaded(note: Note?) {
152152
super.onNoteLoaded(note)
153+
if (note == null) {
154+
Log_OC.w(TAG, "Note is null, onNoteLoaded")
155+
return
156+
}
157+
153158
Log.d(TAG, "onNoteLoaded() called")
154159
val newNoteParam = arguments?.getSerializable(PARAM_NEWNOTE) as Note?
155160
if (newNoteParam != null || note.remoteId == null) {

app/src/main/java/it/niedermann/owncloud/notes/edit/NotePreviewFragment.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
137137
@Override
138138
protected void onNoteLoaded(Note note) {
139139
super.onNoteLoaded(note);
140+
if (note == null) {
141+
Log_OC.w(TAG, "Note is null, onNoteLoaded");
142+
return;
143+
}
144+
140145
noteLoaded = true;
141146
registerInternalNoteLinkHandler();
142147

0 commit comments

Comments
 (0)