HomePhabricator

Fix Javascript busy loop when trying to delete tokens from an empty tokenizer

Description

Fix Javascript busy loop when trying to delete tokens from an empty tokenizer

Summary:
Fixes T13147. In D19437, I changed this logic to support deleting the "" (empty string) token, but [].pop() returns undefined, not null, if the list is empty and I didn't think to try deleting an empty input.

Fix the logic so we don't end up in a loop if the input is empty.

Test Plan:

  • In any browser, deleted all tokens in a tokenizer; then pressed delete again.
  • Before: tab hangs in an infinte loop.
  • After: smooth sailing.

Reviewers: amckinley, avivey

Reviewed By: avivey

Maniphest Tasks: T13147

Differential Revision: https://secure.phabricator.com/D19456