Fix null error on window resizing (#2501)

* Fix null error on window resizing

* Be more specific in type cast (dae)
This commit is contained in:
Austin S 2023-05-17 00:52:38 -06:00 committed by GitHub
parent c54b897b4f
commit eebd143a9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -120,6 +120,7 @@ Ben Kerman <ben@kermanic.org>
Euan Kemp <euank@euank.com>
Kieran Black <kieranlblack@gmail.com>
XeR <github.com/XeR>
Austin Siew <github.com/Aquafina-water-bottle>
********************

View file

@ -12,7 +12,11 @@ export function setupImageCloze(): void {
}
function setupImageClozeInner(): void {
const canvas: HTMLCanvasElement = document.querySelector("canvas")! as HTMLCanvasElement;
const canvas = document.querySelector("canvas") as HTMLCanvasElement | null;
if (canvas == null) {
return;
}
canvas.style.maxWidth = "100%";
canvas.style.maxHeight = "95vh";