Skip to content

Layer reports true on HasImage, panics when encoded as image #19

Description

@drdreo

Behavior
When a certain layer is a vector (simple pen tool shape), HasImage() returns true but the Picker of said layer has no image data which panics on png.Encode with the message:
png: invalid format: invalid image size: 0x0

Expected
A layer which currently can not be parsed, and hence, has no image data, should return false on HasImage.

Code

        if !l.HasImage() {
		return nil
	}
	fmt.Printf("%s -> %s.png\n", layerName, filename)
	out, err := os.Create(fmt.Sprintf("%s.png", filename))
	if err != nil {
		return err
	}
	defer out.Close()
	return png.Encode(out, l.Picker)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions