diff --git a/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp b/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp index ba93735ece..d429664942 100644 --- a/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +++ b/package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp @@ -78,6 +78,11 @@ void RNSkOpenGLCanvasProvider::surfaceSizeChanged(int width, int height) { return; } + if (_surfaceHolder == nullptr) { + // No surface holder, nothing to do + return; + } + // Recreate RenderContext surface based on size change??? _surfaceHolder->resize(width, height); diff --git a/package/cpp/rnskia/RNSkJsiViewApi.h b/package/cpp/rnskia/RNSkJsiViewApi.h index 54343db101..280f936ff8 100644 --- a/package/cpp/rnskia/RNSkJsiViewApi.h +++ b/package/cpp/rnskia/RNSkJsiViewApi.h @@ -313,9 +313,9 @@ class RNSkJsiViewApi : public RNJsi::JsiHostObject, * @return The callback info object for the requested view */ RNSkViewInfo *getEnsuredViewInfo(size_t nativeId) { + std::lock_guard lock(_mutex); if (_viewInfos.count(nativeId) == 0) { RNSkViewInfo info; - std::lock_guard lock(_mutex); _viewInfos.emplace(nativeId, info); } return &_viewInfos.at(nativeId);