fix an exception when changing tabs

fixes https://github.com/dart-lang/chromedeveditor/issues/3451