prevent crashing when selecting invalid unicode character.
Konsole goes into an infinite loop and will eventually crash due to memory. On an invalid unicode char the width is 0 so the for loop never exits. This should prevent the crashes; not sure if there is a better way. CCBUG: 303390