Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions headless_surface_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,10 @@ func TestHeadlessSurfaceReadPixelsStateErrors(t *testing.T) {
}
})
}

func TestSurfaceWritePixelsNil(t *testing.T) {
var surface *Surface
if err := surface.WritePixels(nil, 0, 0); !errors.Is(err, ErrReleased) {
t.Fatalf("WritePixels error = %v, want ErrReleased", err)
}
}
2 changes: 1 addition & 1 deletion surface_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ func (s *Surface) PresentPixels(data []byte, width, height uint32, damageRects [
// Call between GetCurrentTexture() and Present(). No render pass needed.
// Returns ErrReleased if the surface is not configured.
func (s *Surface) WritePixels(data []byte, width, height uint32) error {
if s.released || s.core == nil {
if s == nil || s.released || s.core == nil {
return ErrReleased
}
raw := s.core.RawSurface()
Expand Down
Loading