Sure it crashes when you give an empty string instead of a path name.

I still don't understand what you want to do. Either you want to attach the entity to a new path, then you must give its name, or not, then you must give NULL. At least thats what the manual tells about ent_movepath.