Skip to content

Commit 69b75a4

Browse files
author
Adam Carruthers
committed
Fix creation error when form is wiped (environmentChanged observer)
1 parent fc65583 commit 69b75a4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

component/component.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ define('ui/components/machine/driver-%%DRIVERNAME%%/component', ['exports', 'emb
8484

8585
environmentChange: function () {
8686
var env = this.environmentsById[this.get('model.%%DRIVERNAME%%Config.environmentId')];
87-
this.set('model.%%DRIVERNAME%%Config.environmentName', env.name);
88-
this.set('model.%%DRIVERNAME%%Config.serviceCode', env.serviceConnection.serviceCode);
87+
if (env) {
88+
this.set('model.%%DRIVERNAME%%Config.environmentName', env.name);
89+
this.set('model.%%DRIVERNAME%%Config.serviceCode', env.serviceConnection.serviceCode);
8990

90-
this.updateTiersOnEnvironmentChange();
91-
this.updateTemplatesOnEnvironmentChange();
91+
this.updateTiersOnEnvironmentChange();
92+
this.updateTemplatesOnEnvironmentChange();
93+
}
9294
}.observes('model.%%DRIVERNAME%%Config.environmentId'),
9395

9496
updateTiersOnEnvironmentChange: function () {

0 commit comments

Comments
 (0)