Javascripterror in function "doesElementScroll()" in combination with owl-carousel

In some cases (probably when owl option changes dynamically and refreshes) owl deletes
some items while a "while loop" is running in "doesElementScroll()" who uses one of that items.
Then the element in the while-loop becomes null while "doesElementScroll" trys to get the parentNode
from that deleted element and then we get an error.