Skip to content

Commit

Permalink
Fix issues where access to properties were failing
Browse files Browse the repository at this point in the history
  • Loading branch information
juaning committed Nov 30, 2021
1 parent 5817090 commit 97a1ccb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/utils/image-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export class ImageUtils {
public static resizeCanvas(inputCanvas: Canvas, targetWidth: number, targetHeight: number): Canvas {
const canvas: Canvas = createCanvas(targetWidth, targetHeight);
const ctx = canvas.getContext('2d');
ctx.drawImage(inputCanvas, 0, 0, inputCanvas.width, inputCanvas.height, 0, 0, targetWidth, targetHeight);
if (inputCanvas) {
ctx.drawImage(inputCanvas, 0, 0, inputCanvas.width, inputCanvas.height, 0, 0, targetWidth, targetHeight);
}
return canvas;
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/mqtt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class Mqtt {
private onConnection(): Promise<void> {
return new Promise<void>((resolve, reject) => {
let interval = setInterval(() => {
if (this.client.connected) {
if (this.client && this.client.connected) {
clearInterval(interval);
resolve();
}
Expand Down

0 comments on commit 97a1ccb

Please sign in to comment.