assimp_view: fix crash when trying to export while no model is loaded.

pull/317/head
Alexander Gessler 2014-07-22 20:35:09 +02:00
parent 3419fedb3c
commit cc32eda226
1 changed files with 4 additions and 5 deletions

View File

@ -1030,18 +1030,17 @@ void PopulateExportMenu()
//-------------------------------------------------------------------------------
void DoExport(size_t formatId)
{
if (!g_szFileName) {
if (!g_szFileName[0]) {
MessageBox(g_hDlg, "No model loaded", "Export", MB_ICONERROR);
return;
}
Exporter exp;
const aiExportFormatDesc* const e = exp.GetExportFormatDescription(formatId);
ai_assert(e);
char szFileName[MAX_PATH*2];
DWORD dwTemp;
DWORD dwTemp = sizeof(szFileName);
if(ERROR_SUCCESS == RegQueryValueEx(g_hRegistry,"ModelExportDest",NULL,NULL,(BYTE*)szFileName, &dwTemp)) {
ai_assert(dwTemp == MAX_PATH + 1);
ai_assert(strlen(szFileName) <= MAX_PATH);
// invent a nice default file name