diff --git a/src/packages/avatarcropper/avatarcropper.taro.tsx b/src/packages/avatarcropper/avatarcropper.taro.tsx index 7730883a33..2f6b3f0a66 100644 --- a/src/packages/avatarcropper/avatarcropper.taro.tsx +++ b/src/packages/avatarcropper/avatarcropper.taro.tsx @@ -272,6 +272,7 @@ export const AvatarCropper: FunctionComponent> = ( if (canvasDom?.tagName !== 'CANVAS') { canvas = canvasDom?.getElementsByTagName('canvas')[0] as HTMLCanvasElement } + if (!canvas) return canvas.width = state.displayWidth canvas.height = state.displayHeight const ctx = canvas.getContext('2d') as CanvasRenderingContext2D