Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ class BitmapDecodeTests {
assertNull(result)
}

@Test
fun testToFileWhenPathIsNullShouldReturnNull() {
val result = null.toFile()
assertNull(result)
}

@Test
fun testToFileWhenFileDoesNotExistShouldReturnNull() {
val nonExistentPath = tempDir.resolve("does_not_exist.jpg")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fun Path.toLocalPath(): String = toAbsolutePath().toString()
* @return [File] instance if the file exists, or `null` if the path is null, empty, or non-existent.
*/
@Suppress("ReturnCount")
fun String.toFile(): File? {
fun String?.toFile(): File? {
if (isNullOrEmpty()) {
Log_OC.w(TAG, "given path is null or empty: $this")
return null
Expand Down
Loading