Avoid crashing on empty inputs