Skip to content

Consider throwing or logging when frame dimensions cannot be determined. #53

@AStevensTaylor

Description

@AStevensTaylor

🧹 Nitpick | 🔵 Trivial

Consider throwing or logging when frame dimensions cannot be determined.

The fallback to { width: 0, height: 0 } will create a 0×0 canvas in loadWebpFrames (line 280), which could produce empty/invalid frames silently. A warning or early return might help with debugging.

♻️ Optional: add a warning for unknown frame types
 	if ("width" in frame && "height" in frame) {
 		return { width: frame.width, height: frame.height };
 	}

+	console.warn("Unknown frame type, could not determine dimensions", frame);
 	return { width: 0, height: 0 };
🤖 Prompt for AI Agents
In `@src/components/GifFrameExtractor.tsx` around lines 54 - 64, The
getFrameDimensions helper currently returns {width:0,height:0} for unknown frame
shapes which leads to a 0×0 canvas in loadWebpFrames and silent failures; update
getFrameDimensions to either throw an Error or call a logger (e.g.,
console.warn/processLogger.warn) when neither displayWidth/displayHeight nor
width/height exist, and adjust callers (notably loadWebpFrames) to handle that
error or early-return when dimensions are invalid so no 0×0 canvas is created.
Ensure the change references the getFrameDimensions function and the
loadWebpFrames consumer so the failure is surfaced (throw if you want to abort
processing, or log + return null/undefined from getFrameDimensions and have
loadWebpFrames skip/return on missing dimensions).

Originally posted by @coderabbitai[bot] in #44 (comment)

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