Fix null pointer dereference in text lookup

Fix potential null pointer dereference for when splitting a node.