Fix invalid .ini file data persistently saving back on next save

This commit is contained in:
ocornut 2014-08-14 15:51:55 +01:00
parent f33eb89018
commit 6c11d7623e

View File

@ -1116,11 +1116,13 @@ static void SaveSettings()
return; return;
for (size_t i = 0; i != g.Settings.size(); i++) for (size_t i = 0; i != g.Settings.size(); i++)
{ {
const ImGuiIniData* ini = g.Settings[i]; const ImGuiIniData* settings = g.Settings[i];
fprintf(f, "[%s]\n", ini->Name); if (settings->Pos.x == FLT_MAX)
fprintf(f, "Pos=%d,%d\n", (int)ini->Pos.x, (int)ini->Pos.y); continue;
fprintf(f, "Size=%d,%d\n", (int)ini->Size.x, (int)ini->Size.y); fprintf(f, "[%s]\n", settings->Name);
fprintf(f, "Collapsed=%d\n", ini->Collapsed); fprintf(f, "Pos=%d,%d\n", (int)settings->Pos.x, (int)settings->Pos.y);
fprintf(f, "Size=%d,%d\n", (int)settings->Size.x, (int)settings->Size.y);
fprintf(f, "Collapsed=%d\n", settings->Collapsed);
fprintf(f, "\n"); fprintf(f, "\n");
} }