added check that node processing will return true.

added (nodes != null && nodes.getLength() > 0)  check that node processing will return true.