1
0
Fork 0

Fixed crash when file can't be opened

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@445
This commit is contained in:
Sjoerd van der Berg 2002-10-25 22:49:42 +00:00
parent 778a243f8d
commit 845e239eba

View file

@ -182,14 +182,20 @@ void CONFIG::Run(void) {
FILE * f;
if (cmd->FindString("-writeconf",temp_line,true)) {
f=fopen(temp_line.c_str(),"wb+");
if (!f) WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_ERROR"),temp_line.c_str());
if (!f) {
WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_ERROR"),temp_line.c_str());
return;
}
fclose(f);
control->PrintConfig(temp_line.c_str());
return;
}
if (cmd->FindString("-writelang",temp_line,true)) {
f=fopen(temp_line.c_str(),"wb+");
if (!f) WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_ERROR"),temp_line.c_str());
if (!f) {
WriteOut(MSG_Get("PROGRAM_CONFIG_FILE_ERROR"),temp_line.c_str());
return;
}
fclose(f);
MSG_Write(temp_line.c_str());
return;