Skip to content

Commit

Permalink
added a check whether the json exists to prevent errors in the console
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicJinn committed Aug 2, 2023
1 parent 40dcff5 commit 45cb377
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mrbeastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function applyOverlayToThumbnails() {
const overlayImageIndex = getRandomImageFromDirectory();
let flip = Math.random() < 0.25; // 25% chance to flip the image
let overlayImageURL
if (flip && flipBlacklist.includes(overlayImageIndex)) {
if (typeof flipBlacklist !== 'undefined' && flip && flipBlacklist.includes(overlayImageIndex)) {
if (useAlternativeImages) {
overlayImageURL = getImageURL(`textFlipped/${overlayImageIndex}`);
flip = false;
Expand Down

2 comments on commit 45cb377

@KTibow
Copy link

@KTibow KTibow commented on 45cb377 Aug 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why typeof flipBlacklist !== 'undefined' instead of && flipBlacklist

@MagicJinn
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing, didn't know that was possible!

Please sign in to comment.