mirror of
https://github.com/SimpleMobileTools/Simple-Notes.git
synced 2025-03-21 02:50:07 +01:00
Fix NPE with empty files
This commit is contained in:
parent
e26e43cd91
commit
c2ff80b9e5
@ -33,7 +33,7 @@ class NotesImporter(private val context: Context) {
|
||||
val json = reader.readText()
|
||||
val type = object : TypeToken<List<Note>>() {}.type
|
||||
val notes = gson.fromJson<List<Note>>(json, type)
|
||||
val totalNotes = notes.size
|
||||
val totalNotes = notes?.size ?: 0
|
||||
if (totalNotes <= 0) {
|
||||
callback.invoke(ImportResult.IMPORT_NOTHING_NEW)
|
||||
return@ensureBackgroundThread
|
||||
|
Loading…
x
Reference in New Issue
Block a user