When you get the node, you're not checking it's valid before you do a get value. If the tag doesn't exist, there's no object to actually getValue from. You need to make sure the node list is valid...