From edd617d0872de7436cd5f83b025f1e6b6d0ff385 Mon Sep 17 00:00:00 2001 From: xufuji456 <839789740@qq.com> Date: Fri, 9 Jul 2021 08:41:42 +0800 Subject: [PATCH] check if happen NullPointer --- .../com/frank/ffmpeg/activity/ProbeFormatActivity.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/frank/ffmpeg/activity/ProbeFormatActivity.kt b/app/src/main/java/com/frank/ffmpeg/activity/ProbeFormatActivity.kt index e2b7e30..7db6d39 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/ProbeFormatActivity.kt +++ b/app/src/main/java/com/frank/ffmpeg/activity/ProbeFormatActivity.kt @@ -45,10 +45,12 @@ class ProbeFormatActivity : BaseActivity() { MSG_FINISH -> { progressProbe!!.visibility = View.GONE layoutProbe!!.visibility = View.VISIBLE - val result = msg.obj as MediaBean - val resultFormat = JsonParseTool.stringFormat(result) - if (!TextUtils.isEmpty(resultFormat) && txtProbeFormat != null) { - txtProbeFormat!!.text = resultFormat + val result = msg.obj?: msg.obj + if (result != null) { + val resultFormat = JsonParseTool.stringFormat(result as MediaBean) + if (!TextUtils.isEmpty(resultFormat) && txtProbeFormat != null) { + txtProbeFormat!!.text = resultFormat + } } } else -> {