graphparser: add a NULL check on the argument passed to strstr