diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt
index d98b0ed6..88192c4d 100644
--- a/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/activities/ReadTextActivity.kt
@@ -67,8 +67,8 @@ class ReadTextActivity : SimpleActivity() {
 
     private fun checkIntent() {
         read_text_view.setTextColor(config.textColor)
-        val uri = if (intent.extras.containsKey(REAL_FILE_PATH)) {
-            Uri.fromFile(File(intent.extras.get(REAL_FILE_PATH).toString()))
+        val uri = if (intent.extras?.containsKey(REAL_FILE_PATH) == true) {
+            Uri.fromFile(File(intent.extras?.get(REAL_FILE_PATH).toString()))
         } else {
             intent.data
         }