Add null string check in list_reverse function