DNN-3619 - added a condition statement to avoid a possible exception