fixed nil checks in tunconf

This commit is contained in:
idk
2018-09-19 11:13:47 -04:00
parent c0d3bcb238
commit 6f166d6cdd
2 changed files with 23 additions and 11 deletions

View File

@ -93,7 +93,11 @@ func (c *Conf) Get(key string, label ...string) (string, bool) {
}
return c.config.SectionGet(c.Labels[0], key)
} else {
return c.config.Get(key)
if c.config != nil {
return c.config.Get(key)
}else{
return "", false
}
}
return "", false
}
@ -106,7 +110,11 @@ func (c *Conf) GetBool(key string, label ...string) (bool, bool) {
}
return c.config.SectionGetBool(c.Labels[0], key)
} else {
return c.config.GetBool(key)
if c.config != nil {
return c.config.GetBool(key)
}else{
return false, false
}
}
return false, false
}
@ -119,7 +127,11 @@ func (c *Conf) GetInt(key string, label ...string) (int, bool) {
}
return c.config.SectionGetInt(c.Labels[0], key)
} else {
return c.config.GetInt(key)
if c.config != nil {
return c.config.GetInt(key)
}else{
return -1, false
}
}
return -1, false
}