libsaria: Check stream status before reading
If we are unable to open the preferences file we shouldn't try to read from it. This led to a segmentation fault when compiled in release mode, but for some reason it worked when compiled in debug mode?
This commit is contained in:
parent
1d704a3ac0
commit
958020f270
|
@ -66,8 +66,12 @@ namespace libsaria
|
||||||
|
|
||||||
void prefs::load()
|
void prefs::load()
|
||||||
{
|
{
|
||||||
|
unsigned int size;
|
||||||
InFile in("preferences");
|
InFile in("preferences");
|
||||||
unsigned int size = in.read_ui();
|
if (!in.good())
|
||||||
|
return;
|
||||||
|
|
||||||
|
size = in.read_ui();
|
||||||
for (unsigned int i = 0; i < size; i++)
|
for (unsigned int i = 0; i < size; i++)
|
||||||
load_pref(in);
|
load_pref(in);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue