diff --git a/frameworks/core/components/swiper/render_swiper.cpp b/frameworks/core/components/swiper/render_swiper.cpp index d9570468760..625da0bce9a 100644 --- a/frameworks/core/components/swiper/render_swiper.cpp +++ b/frameworks/core/components/swiper/render_swiper.cpp @@ -1314,14 +1314,14 @@ void RenderSwiper::UpdateItemPosition(double offset, int32_t index, int32_t othe int32_t prevIndex = GetPrevIndex(index); if (prevIndex != index && prevIndex != otherIndex) { auto item = items_.find(prevIndex); - if (iter != items_.end()) { + if (item != items_.end()) { item->second->SetPosition(GetMainAxisOffset(offset + (needReverse_ ? nextItemOffset_ : prevItemOffset_))); } } int32_t nextIndex = GetNextIndex(index); if (nextIndex != index && nextIndex != otherIndex) { auto item = items_.find(nextIndex); - if (iter != items_.end()) { + if (item != items_.end()) { item->second->SetPosition(GetMainAxisOffset(offset + (needReverse_ ? prevItemOffset_ : nextItemOffset_))); } } diff --git a/frameworks/core/image/image_provider.cpp b/frameworks/core/image/image_provider.cpp index b4a5a57f257..2e292ca6a84 100644 --- a/frameworks/core/image/image_provider.cpp +++ b/frameworks/core/image/image_provider.cpp @@ -248,6 +248,10 @@ void ImageProvider::UploadImageToGPUForRender( const std::function)>&& callback, const RefPtr& renderTaskHolder) { + if (!renderTaskHolder) { + LOGW("renderTaskHolder has been released."); + return; + } #if defined(DUMP_DRAW_CMD) || defined(GPU_DISABLED) // If want to dump draw command or gpu disabled, should use CPU image. callback({ image, renderTaskHolder->unrefQueue }); @@ -261,6 +265,10 @@ void ImageProvider::UploadImageToGPUForRender( return; } auto task = [rasterizedImage, callback, renderTaskHolder] () { + if (!renderTaskHolder) { + LOGW("renderTaskHolder has been released."); + return; + } // weak reference of io manager must be check and used on io thread, because io manager is created on io thread. if (!renderTaskHolder->ioManager) { // Shell is closing.