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
4 changes: 4 additions & 0 deletions negative2positive/src/app/rawFileLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ export async function loadRawFile(buffer, fileName, options = {}) {
}
throw err;
}
if (!result || !result.data) {
console.error('[RAW] imageData returned empty result', result);
return await handleTimeoutFallback();
Comment on lines +240 to +242

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat zero-length image data as empty

When raw.imageData() returns a result object whose data is an empty typed array, this guard does not take the JPEG fallback because typed arrays are truthy. The code then continues into the RGB conversion path, where reads from the empty array become zeroes and the app can display a black image instead of falling back for unsupported RAW files. Please also validate that result.data.length is non-zero, ideally against the expected width * height payload size.

Useful? React with 👍 / 👎.

}
const { width, height, data: rgbData } = result;

const pixelCount = width * height;
Expand Down
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@techstark/opencv-js": "4.12.0-release.1",
"@vercel/analytics": "^2.0.1",
"jszip": "3.10.1",
"libraw-wasm": "^1.1.2",
"libraw-wasm": "github:lexluthor0304/LibRaw-Wasm",
"pako": "2.1.0",
"three": "^0.183.2",
"upng-js": "2.1.0",
Expand Down
Loading