Skip to content

Commit 444d22b

Browse files
committed
prevent error loop in case of undefined $wrapper.data('multipleInput')
if for any reason this code line fails, the interval is not removed and console.log fills with error messages every 10ms. This change prevents that from happening. I have no idea why it fails, but the widget works fine.
1 parent 651f07c commit 444d22b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/assets/src/js/jquery.multipleInput.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@
212212
// If after a second system could not detect ActiveForm it means
213213
// that widget is used without ActiveForm and we should just complete initialization of the widget
214214
if (form.length === 0 || i > 10) {
215-
$wrapper.data('multipleInput').currentIndex = findMaxRowIndex($wrapper);
215+
clearInterval(intervalID);
216216
isActiveFormEnabled = false;
217217

218-
clearInterval(intervalID);
218+
if (typeof $wrapper.data('multipleInput') !== 'undefined') {
219+
$wrapper.data('multipleInput').currentIndex = findMaxRowIndex($wrapper);
220+
}
221+
219222
$wrapper.trigger(event);
220223
}
221224
}, 100);

0 commit comments

Comments
 (0)