Fix for getprivateint/string defaultvalue, check for value, not just section (#944)

* Fix for getprivateint defaultvalue, check for value, not just section

* fix getprivatestring too
This commit is contained in:
jberg 2019-10-11 16:13:15 -07:00 committed by Jordan Eldredge
parent 9ec4b8d882
commit 59feff8dd5

View file

@ -119,7 +119,10 @@ class System extends MakiObject {
}
getprivateint(section: string, item: string, defvalue: number): number {
if (!this._privateInt.has(section)) {
if (
!this._privateInt.has(section) ||
!this._privateInt.get(section).has(item)
) {
return defvalue;
}
// @ts-ignore We know this section exists
@ -630,7 +633,10 @@ class System extends MakiObject {
}
getprivatestring(section: string, item: string, defvalue: string): string {
if (!this._privateString.has(section)) {
if (
!this._privateString.has(section) ||
!this._privateString.get(section).has(item)
) {
return defvalue;
}
// @ts-ignore We know the section exists