mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 09:39:33 +00:00
Fix storing nans and infs in preferences in simulator
Turns out file streams cannot parse nans and infs on some platforms, so use std::stof to parse.
This commit is contained in:
parent
e389d717d6
commit
449dd44741
@ -14,10 +14,9 @@ private:
|
|||||||
|
|
||||||
void readFromFile() {
|
void readFromFile() {
|
||||||
std::ifstream file(storagePath);
|
std::ifstream file(storagePath);
|
||||||
std::string key;
|
std::string key, value;
|
||||||
float value;
|
|
||||||
while (file >> key >> value) {
|
while (file >> key >> value) {
|
||||||
storage[key] = value;
|
storage[key] = std::stof(value); // using stof to support NaN and Infinity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user