TOMEE-1399

Moved the null check before the dereference.