Avoid SEGV when passed NULL for list