From 0b24e59d09a63ebc18407fee6cc73f4f087aba0b Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Mon, 26 Jun 2023 11:09:32 +0800 Subject: [PATCH] [3.3.0]fix V2xObuEventManager.onMoGoObuSaveMessage NullPointerException --- .../biz/v2x/obu/V2xObuEventManager.kt | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt index a16a7f3f71..afaaa4585a 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/obu/V2xObuEventManager.kt @@ -5,7 +5,6 @@ import com.mogo.eagle.core.data.enums.DataSourceType import com.mogo.eagle.core.data.msgbox.MsgBoxBean import com.mogo.eagle.core.data.msgbox.MsgBoxType import com.mogo.eagle.core.data.msgbox.V2XMsg -import com.mogo.eagle.core.data.obu.MogoObuConst import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuSaveMessageListener import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager @@ -37,20 +36,19 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener { * @param content 事件内容 * @param tts 事件语音播报 //30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理 */ - override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) { + override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType) { if (content.isNotEmpty()) { if (obuDataMap.containsKey(type)) { - var oldTime = obuDataMap[type] - var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000 - if (timeDiff < 30) { - return + val oldTime = obuDataMap[type] + oldTime?.let { + val timeDiff = (System.currentTimeMillis() - it) / 1000 + if (timeDiff < 30) { + return + } + obuDataMap.remove(type) } - obuDataMap.remove(type) - obuDataMap[type] = System.currentTimeMillis() - } else { - obuDataMap[type] = System.currentTimeMillis() } - + obuDataMap[type] = System.currentTimeMillis() CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onMoGoObuSaveMessage type = $type ---content = $content ---tts = $tts ") CallerMsgBoxManager.saveMsgBox( MsgBoxBean( @@ -61,7 +59,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener { tts ) ).apply { - sourceType = source + this.sourceType = sourceType } ) }