Fix segfault with empty list