If you are saying that list->at(0) returns NULL Then the pointer pEnd will be NULL.
Therefore doing this *pEnd is de-referencing a NULL pointer which will obviously seg fault.
If you want to chek for this, you could check the pointer before de-referencing. for eg:
if(pEnd == NULL)
//Do nothing or throw error or something
else
//Go ahead and do your stuff
1
solved char * SEGMENTATION FAULT [closed]