check for empty response on migration settings (#2877)

(close #2872) (close #2862)
This commit is contained in:
Aravind Shankar 2019-09-16 14:20:46 +05:30 committed by Shahidh K Muhammed
parent d1eeb3283c
commit b39d7b977b

View File

@ -160,13 +160,13 @@ func (h *HasuraDB) GetSetting(name string) (value string, err error) {
return value, fmt.Errorf("Invalid result Type %s", hres.ResultType)
}
if len(hres.Result) == 0 {
if len(hres.Result) < 2 {
for _, setting := range h.settings {
if setting.GetName() == name {
return setting.GetDefaultValue(), nil
}
}
return "", nil
return value, fmt.Errorf("Invalid setting name: %s", name)
}
return hres.Result[1][0], nil