mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-12-03 13:06:04 +00:00
fix null pointer problems
Signed-off-by: caocan <1532643766@qq.com> Change-Id: Ibb957a6f4744525c09126c0e12a12c98983decef
This commit is contained in:
parent
e840a25b79
commit
dde64e3cec
@ -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_)));
|
||||
}
|
||||
}
|
||||
|
@ -248,6 +248,10 @@ void ImageProvider::UploadImageToGPUForRender(
|
||||
const std::function<void(flutter::SkiaGPUObject<SkImage>)>&& callback,
|
||||
const RefPtr<FlutterRenderTaskHolder>& 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.
|
||||
|
Loading…
Reference in New Issue
Block a user