Fix crash with non-existent node and * path

If a node is non-existent (cur is nil), we still look for the ->type and crashes.