Add additional error checking

Handles cases in which no nodes are returned.