Skip to content

Commit 1e4c4d5

Browse files
committed
change back report variable, make value conditional
1 parent 8178b92 commit 1e4c4d5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/utils/previewEntry.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ window.onunhandledrejection = async function onUnhandledRejection(event) {
148148
};
149149

150150
// Monkeypatch p5._friendlyError
151-
const p5Call = window.p5;
152151

153-
if (p5Call) {
152+
const _report = window.p5?.report;
153+
154+
if (_report) {
154155
window.p5._report = function resolvedReport(message, method, color) {
155156
const urls = Object.keys(window.objectUrls);
156157
const paths = Object.keys(window.objectPaths);
@@ -176,6 +177,6 @@ if (p5Call) {
176177
paths.forEach((path) => {
177178
newMessage = newMessage.replaceAll(path, window.objectPaths[path]);
178179
});
179-
p5Call.apply(window.p5, [newMessage, method, color]);
180+
_report.apply(window.p5, [newMessage, method, color]);
180181
};
181182
}

0 commit comments

Comments
 (0)