fix: Made workspace non-nullable. (#6300)

* Made workspace non-nullable.

* chore: clang-format files.

* fix: Fixed incorrect block disposal check in connection.ts
This commit is contained in:
Aaron Dodson
2022-08-02 13:36:15 -07:00
committed by GitHub
parent 21d90696d1
commit 83a3e74ec9
27 changed files with 121 additions and 130 deletions

View File

@@ -264,7 +264,7 @@ export abstract class Field implements IASTNodeLocationSvg,
* @return The renderer constant provider.
*/
getConstants(): ConstantProvider|null {
if (!this.constants_ && this.sourceBlock_ && this.sourceBlock_.workspace &&
if (!this.constants_ && this.sourceBlock_ && !this.sourceBlock_.disposed &&
this.sourceBlock_.workspace.rendered) {
this.constants_ = (this.sourceBlock_.workspace as WorkspaceSvg)
.getRenderer()
@@ -1023,7 +1023,7 @@ export abstract class Field implements IASTNodeLocationSvg,
* @param e Mouse down event.
*/
protected onMouseDown_(e: Event) {
if (!this.sourceBlock_ || !this.sourceBlock_.workspace) {
if (!this.sourceBlock_ || this.sourceBlock_.disposed) {
return;
}
const gesture = (this.sourceBlock_.workspace as WorkspaceSvg).getGesture(e);