Fixed bug with Firefox crash...

...but the overlay is still broken! However, the broken parts won't kill wplace.
This commit is contained in:
SwingTheVine 2025-08-07 17:26:34 -04:00
parent ca34eeeea8
commit e1e9e9816e
2 changed files with 5 additions and 5 deletions

View file

@ -65,7 +65,7 @@ export default class Overlay {
this.overlay = element; // Declare it the highest overlay element
this.currentParent = element;
} else {
this.currentParent.appendChild(element); // ...else delcare it the child of the last element
this.currentParent?.appendChild(element); // ...else delcare it the child of the last element
this.parentStack.push(this.currentParent);
this.currentParent = element;
}
@ -117,7 +117,7 @@ export default class Overlay {
* // <div><p></p></div>
*/
buildOverlay(parent) {
parent.appendChild(this.overlay);
parent?.appendChild(this.overlay);
// Resets the class-bound variables of this class instance back to default so overlay can be build again later
this.overlay = null;

View file

@ -22,7 +22,7 @@ function inject(callback) {
script.setAttribute('bm-name', name); // Passes in the name value
script.setAttribute('bm-cStyle', consoleStyle); // Passes in the console style value
script.textContent = `(${callback})();`;
document.documentElement.appendChild(script);
document.documentElement?.appendChild(script);
script.remove();
}
@ -170,7 +170,7 @@ stylesheetLink.onload = function () {
this.onload = null;
this.rel = 'stylesheet';
};
document.head.appendChild(stylesheetLink);
document.head?.appendChild(stylesheetLink);
// CONSTRUCTORS
const observers = new Observers(); // Constructs a new Observers object
@ -226,7 +226,7 @@ function observeBlack() {
// Attempts to find the "Paint Pixel" element for anchoring
const paintPixel = black.parentNode.parentNode.parentNode.parentNode.querySelector('h2');
paintPixel.parentNode.appendChild(move); // Adds the move button
paintPixel.parentNode?.appendChild(move); // Adds the move button
}
});