From 0e1721b13084dacf63089e47116f7d5331be4f36 Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Fri, 26 Mar 2021 16:37:08 -0400 Subject: [PATCH] Fixed Contract properties that collide with null member properties (#1393). --- packages/contracts/src.ts/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/contracts/src.ts/index.ts b/packages/contracts/src.ts/index.ts index a13388e2f5..6a5c3d949b 100644 --- a/packages/contracts/src.ts/index.ts +++ b/packages/contracts/src.ts/index.ts @@ -741,9 +741,12 @@ export class Contract { const signature = signatures[0]; - if (this[name] == null) { - defineReadOnly(this, name, this[signature]); - } + // If overwriting a member property that is null, swallow the error + try { + if (this[name] == null) { + defineReadOnly(this, name, this[signature]); + } + } catch (e) { } if (this.functions[name] == null) { defineReadOnly(this.functions, name, this.functions[signature]);