Fixed #5939 (fp: Possible null pointer dereference, after check against NULL in for loop)