1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-28 14:56:33 -04:00

check for nil

This commit is contained in:
Darien Raymond 2017-01-13 14:33:28 +01:00
parent f7e1f00c88
commit 07866e6d39
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -72,11 +72,17 @@ func (v *spaceImpl) Initialize() error {
}
func (v *spaceImpl) GetApplication(appInterface interface{}) Application {
if v == nil {
return nil
}
appType := reflect.TypeOf(appInterface)
return v.cache[appType]
}
func (v *spaceImpl) AddApplication(app Application) error {
if v == nil {
return errors.New("App: Nil space.")
}
appType := reflect.TypeOf(app.Interface())
v.cache[appType] = app
return nil