You should check `doc->file_type->extension != NULL` before passing it to `MultiByteToWideChar()`, I doubt `NULL` is a valid value for the `lpMultiByteStr` argument.  Also, although there currently is a bug in many calls, the last argument should be the number of *wide chars* in `w_file_type`, not number of bytes.  Use `G_N_ELEMENTS(w_file_type)`.

Also, you should check if `doc->file_type` also before accessing its content.  I would think it's not required, but the code is a bit tricky, and we do the check in a lot of places, so maybe it's really required.  And anyway, it doesn't hurt.