Skip to content

Commit c2ff80b

Browse files
committed
Fix NPE with empty files
1 parent e26e43c commit c2ff80b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/main/kotlin/com/simplemobiletools/notes/pro/helpers/NotesImporter.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class NotesImporter(private val context: Context) {
3333
val json = reader.readText()
3434
val type = object : TypeToken<List<Note>>() {}.type
3535
val notes = gson.fromJson<List<Note>>(json, type)
36-
val totalNotes = notes.size
36+
val totalNotes = notes?.size ?: 0
3737
if (totalNotes <= 0) {
3838
callback.invoke(ImportResult.IMPORT_NOTHING_NEW)
3939
return@ensureBackgroundThread

0 commit comments

Comments
 (0)