fix: add missing nil check in store.GetStore (#9354)

* fix: add missing nil check in store.GetStore

* check nil in rootmulti as well
This commit is contained in:
Robert Zaremba
2021-05-19 08:17:46 +00:00
committed by GitHub
parent 377360a391
commit b065e20f2b
3 changed files with 34 additions and 3 deletions
+5 -1
View File
@@ -492,7 +492,11 @@ func (rs *Store) GetStore(key types.StoreKey) types.Store {
// NOTE: The returned KVStore may be wrapped in an inter-block cache if it is
// set on the root store.
func (rs *Store) GetKVStore(key types.StoreKey) types.KVStore {
store := rs.stores[key].(types.KVStore)
s := rs.stores[key]
if s == nil {
panic(fmt.Sprintf("store does not exist for key: %s", key.Name()))
}
store := s.(types.KVStore)
if rs.TracingEnabled() {
store = tracekv.NewStore(store, rs.traceWriter, rs.traceContext)