解决音乐播放完死机问题
authorluozheng <1732036298@qq.com>
Fri, 26 Jul 2024 09:30:38 +0000 (17:30 +0800)
committerluozheng <1732036298@qq.com>
Fri, 26 Jul 2024 09:30:38 +0000 (17:30 +0800)
code/sdk/application/wearable/fd230app/nativeui/player/src/PlayersModel.cpp

index 526adb4..f424ee7 100644 (file)
@@ -169,15 +169,19 @@ int16_t PlayersModel::GetCurrentIndex(void)
 
 void PlayersModel::SetCurrentIndex(int16_t value)
 {
+    WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersModel::SetCurrentIndex,value = %d",value);
     currentIndex = value;
     /* -------------------------------------------------------------------------- */
     m_PlayersCaseListAdapter = PlayersCaseListAdapter::GetInstance();
-    m_PlayersCaseListAdapter->p_BtnOnClickListListener->SongClick(m_PlayersCaseListAdapter,currentIndex);
-    for(int i= 0;i<m_PlayersCaseListAdapter->GetCount();i++)
+    if(m_PlayersCaseListAdapter!=nullptr)
     {
-        if(i != currentIndex)
+        m_PlayersCaseListAdapter->p_BtnOnClickListListener->SongClick(m_PlayersCaseListAdapter,currentIndex);
+        for(int i= 0;i<m_PlayersCaseListAdapter->GetCount();i++)
         {
-           m_PlayersCaseListAdapter->p_BtnOnClickListListener->SongNotClick(m_PlayersCaseListAdapter,i);
+            if(i != currentIndex)
+            {
+                m_PlayersCaseListAdapter->p_BtnOnClickListListener->SongNotClick(m_PlayersCaseListAdapter,i);
+            }
         }
     }
     PlayersView::GetInstance()->GetPlayerList();