Fixed potential bug in NodeGadget::create().

It was possible to dereference an invalid iterator if no creator was registered for the base node type. This didn't happen in practice, but the new implementation is more idiomatic, doesn't allocate temporary memory unnecessarily and should keep Coverity happy.