Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: don't apply filter if there's no canvas

httpjamesmb9a34c4889eb
diff --git a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
index d54d8604a7..8e78c4f437 100644
--- a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
+++ b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
@@ -76,12 +76,16 @@ const ImageEditorOverlay = (props: IProps) => {
const [invert, setInvert] = useState(false);
useEffect(() => {
+ if (!canvasRef.current) {
+ return;
+ }
+
const filterString = `brightness(${brightness}%) contrast(${contrast}%) blur(${blur}px) saturate(${saturation}%) invert(${
invert ? 1 : 0
})`;
canvasRef.current.style.filter = filterString;
- }, [brightness, contrast, blur, saturation, invert]);
+ }, [brightness, contrast, blur, saturation, invert, canvasRef]);
useEffect(() => {
if (currentRotationAngle >= 360 || currentRotationAngle <= -360) {