isteven / angular-multi-select

A multi select dropdown directive for AngularJS. Allows you to use HTML tags and CSS in the data. Requires only AngularJS and nothing else.
isteven.github.io/angular-multi-select
MIT License
1.08k stars 518 forks source link

Fix race condition on deleting clickedItem #483

Open odinho opened 8 years ago

odinho commented 8 years ago

If you have some code removing all items before the timeout is able to run, you'll get a nasty TypeError if you don't null check clickedItem.

odinho commented 8 years ago

I saw a lot of this error when trying to make our selenium tests be free of console errors. The exception message in Opera and Chromium-based browsers is:

TypeError: Cannot convert undefined or null to object
isteven commented 8 years ago

@odinho ,

Thanks for the PR. Can you ensure that this breaks none of the existing functionalities? If all are OK, I'm going to merge it.

odinho commented 6 years ago

I never got to write full tests. But it did not break any of the internal tests for Hola when I worked there, and this patch was (and still is) used for all their web pages and control panels. So it has seen a lot of use.

It shouldn't break something, but then maybe it will.