fixes #2850 Crash when entering a hint that is too long

Fixed the issue pushed the code for review, please check it.