Fixed a bug which caused a segfault

Empty input would lead to a segfault since the program does not shut down
automatically