Skip to content

Commit e97df9a

Browse files
author
AZhurav1ev
committed
Prevented enjoyHint crash without element position
1 parent dbc1f26 commit e97df9a

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
node_modules/*
2-
lib/*
2+
lib/*
3+
bootstrap_test
4+
to_do_demo_test

enjoyhint.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@
281281
scroll: step_data.scroll
282282
};
283283

284+
if (shape_data.center_x === 0 && shape_data.center_y === 0) {
285+
$body.enjoyhint("hide");
286+
destroyEnjoy();
287+
return console.log("Error: Element position couldn't be reached");
288+
}
289+
284290
if (step_data.shape && step_data.shape == "circle") {
285291
shape_data.shape = "circle";
286292
shape_data.radius = radius;
@@ -379,6 +385,8 @@
379385
case "skip":
380386
skipAll();
381387
break;
388+
389+
default: $body.trigger(makeEventName(event_name, true));
382390
}
383391
};
384392

enjoyhint.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/enjoyhint.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@
281281
scroll: step_data.scroll
282282
};
283283

284+
if (shape_data.center_x === 0 && shape_data.center_y === 0) {
285+
$body.enjoyhint("hide");
286+
destroyEnjoy();
287+
return console.log("Error: Element position couldn't be reached");
288+
}
289+
284290
if (step_data.shape && step_data.shape == "circle") {
285291
shape_data.shape = "circle";
286292
shape_data.radius = radius;
@@ -379,6 +385,8 @@
379385
case "skip":
380386
skipAll();
381387
break;
388+
389+
default: $body.trigger(makeEventName(event_name, true));
382390
}
383391
};
384392

0 commit comments

Comments
 (0)