Added try-catch to prevent crash on entry of text.