Skip to content

Commit

Permalink
Fixed loading an organ when some configuration entry is out of range G…
Browse files Browse the repository at this point in the history
  • Loading branch information
oleg68 committed Nov 14, 2023
1 parent a09673e commit ae4f5f1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fixed loading an organ when some configuration entry is out of range https://github.com/GrandOrgue/grandorgue/issues/1696
- Fixed crash on closing an organ https://github.com/GrandOrgue/grandorgue/issues/1678
# 3.13.1 (2023-11-05)
- Fixed the maximal value of the "SYSEX Hauptwerk 32 Byte LCD" midi send events https://github.com/GrandOrgue/grandorgue/issues/1686
Expand Down
40 changes: 20 additions & 20 deletions src/core/config/GOConfigReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,16 @@ int GOConfigReader::ReadInteger(
value.c_str());
}

if (nmin <= retval && retval <= nmax)
return retval;

wxString error;
error.Printf(
_("Out of range value at section '%s' entry '%s': %ld"),
group,
key,
retval);
throw error;
if (retval < nmin || retval > nmax) {
wxLogError(
_("Out of range value at section '%s' entry '%s': %ld. Assumed %d"),
group,
key,
retval,
defaultValue);
retval = defaultValue;
}
return retval;
}

int GOConfigReader::ReadLong(
Expand Down Expand Up @@ -455,16 +455,16 @@ double GOConfigReader::ReadFloat(
throw error;
}

if (nmin <= retval && retval <= nmax)
return retval;

wxString error;
error.Printf(
_("Out of range value at section '%s' entry '%s': %f"),
group.c_str(),
key.c_str(),
retval);
throw error;
if (retval < nmin || retval > nmax) {
wxLogError(
_("Out of range value at section '%s' entry '%s': %f. Assumed %f."),
group,
key,
retval,
defaultValue);
retval = defaultValue;
}
return retval;
}

unsigned GOConfigReader::ReadSize(
Expand Down

0 comments on commit ae4f5f1

Please sign in to comment.