Skip to content

A platform for community discussion. Free, open, simple.

FIX: Wizard theme preview when logo is missing (#10914)

Penar Musaraj2b5ca8af125d
diff --git a/app/assets/javascripts/wizard/lib/preview.js b/app/assets/javascripts/wizard/lib/preview.js
index 73b4513d224..fd17028beef 100644
--- a/app/assets/javascripts/wizard/lib/preview.js
+++ b/app/assets/javascripts/wizard/lib/preview.js
@@ -161,21 +161,22 @@ export function createPreviewComponent(width, height, obj) {
drawHeader(ctx, colors, width, headerHeight);
const avatarSize = height * 0.1;
-
- // Logo
const headerMargin = headerHeight * 0.2;
- const logoHeight = headerHeight - headerMargin * 2;
- const ratio = logoHeight / logo.height;
- this.scaleImage(
- logo,
- headerMargin,
- headerMargin,
- logo.width * ratio,
- logoHeight
- );
+ if (logo) {
+ const logoHeight = headerHeight - headerMargin * 2;
+
+ const ratio = logoHeight / logo.height;
+ this.scaleImage(
+ logo,
+ headerMargin,
+ headerMargin,
+ logo.width * ratio,
+ logoHeight
+ );
- this.scaleImage(logo, width, headerMargin);
+ this.scaleImage(logo, width, headerMargin);
+ }
// Top right menu
this.scaleImage(