[SF#904]Check if g_file_get_basename() returned NULL and don't use it.

This may happen in case if file became invalid (e.g. renamed by third party)
while operation was in progress.