Fix bug with custom importer and undefined behavior

Worked on windows but fails on linux, since strdup(0)
is undefined behavior. Avoid calling it in that case!