diff --git a/examples/texture_arrays/main.c b/examples/texture_arrays/main.c index a8ba551b..afb2c36b 100644 --- a/examples/texture_arrays/main.c +++ b/examples/texture_arrays/main.c @@ -667,7 +667,9 @@ int main(int argc, char *argv[]) { case WGPUSurfaceGetCurrentTextureStatus_Outdated: case WGPUSurfaceGetCurrentTextureStatus_Lost: { // Skip this frame, and re-configure surface. - wgpuTextureRelease(surface_texture.texture); + if (surface_texture.texture != NULL) { + wgpuTextureRelease(surface_texture.texture); + } int width, height; glfwGetWindowSize(window, &width, &height); if (width != 0 && height != 0) { diff --git a/examples/triangle/main.c b/examples/triangle/main.c index e6272ead..e82e2ce4 100644 --- a/examples/triangle/main.c +++ b/examples/triangle/main.c @@ -304,7 +304,9 @@ int main(int argc, char *argv[]) { case WGPUSurfaceGetCurrentTextureStatus_Outdated: case WGPUSurfaceGetCurrentTextureStatus_Lost: { // Skip this frame, and re-configure surface. - wgpuTextureRelease(surface_texture.texture); + if (surface_texture.texture != NULL) { + wgpuTextureRelease(surface_texture.texture); + } int width, height; glfwGetWindowSize(window, &width, &height); if (width != 0 && height != 0) {