Skip to content

Commit 6adee66

Browse files
david-allisonmikehardy
authored andcommitted
refactor(media): make 'addFile' input non-null
1 parent fd58566 commit 6adee66

File tree

1 file changed

+2
-4
lines changed
  • libanki/src/main/java/com/ichi2/anki/libanki

1 file changed

+2
-4
lines changed

libanki/src/main/java/com/ichi2/anki/libanki/Media.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ open class Media(
7373
*/
7474
@LibAnkiAlias("add_file")
7575
@RustCleanup("use backend exception instead of EmptyMediaException")
76-
fun addFile(file: File?): String {
76+
fun addFile(file: File): String {
7777
// fail if non-existing or empty
78-
if (file == null || file.length() == 0L) {
79-
throw EmptyMediaException()
80-
}
78+
if (file.length() == 0L) throw EmptyMediaException()
8179
return writeData(file.name, file.readBytes().toByteString())
8280
}
8381

0 commit comments

Comments
 (0)