Inserted an if to prevent php warnings

I seriously forgot why I inserted this conditional, but without it there was a warning produced. I think it was while testing.
It won't hurt to insert it, I think. 

Finally I found out how to push only one commit :P