Could you add a comment about why next being NULL is the only case that needs this error?  Not doubting you, it's just not immediately apparent.