[main] Fix seg fault when not typing text
[main] Fix memory crash when parsing line with leading spaces