Use a local variable for the port list, use correct null ptr macro