diff --git a/rosen/modules/render_service_base/src/property/rs_filter_cache_manager.cpp b/rosen/modules/render_service_base/src/property/rs_filter_cache_manager.cpp index 969860a566..5b322d2ef2 100644 --- a/rosen/modules/render_service_base/src/property/rs_filter_cache_manager.cpp +++ b/rosen/modules/render_service_base/src/property/rs_filter_cache_manager.cpp @@ -240,6 +240,10 @@ void RSFilterCacheManager::GenerateFilteredSnapshot( // Create an offscreen canvas with the same size as the filter region. auto offscreenRect = dstRect; auto offscreenSurface = surface->MakeSurface(offscreenRect.GetWidth(), offscreenRect.GetHeight()); + if (offscreenSurface == nullptr) { + RS_LOGD("RSFilterCacheManager::GenerateFilteredSnapshot offscreenSurface is nullptr"); + return; + } RSPaintFilterCanvas offscreenCanvas(offscreenSurface.get()); // Src rect and dst rect, with origin at (0, 0).