Skip to content

Commit

Permalink
Merge pull request #97 from juaning/fix-motion-error
Browse files Browse the repository at this point in the history
Fix issues where access to properties were failing
  • Loading branch information
beele authored Dec 17, 2021
2 parents 5817090 + 97a1ccb commit b9e34ac
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 b9e34ac

Please sign in to comment.