Skip to content

Commit

Permalink
Fixed delayed network detection attempting to overwrite read-only val…
Browse files Browse the repository at this point in the history
…ue (#854).
  • Loading branch information
ricmoo committed May 29, 2020
1 parent 180a1af commit 8efd8d2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/providers/src.ts/base-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,15 @@ export class BaseProvider extends Provider {
}

// This should never happen; every Provider sub-class should have
// suggested a network by here (or thrown).
// suggested a network by here (or have thrown).
if (!network) {
logger.throwError("no network detected", Logger.errors.UNKNOWN_ERROR, { });
}

defineReadOnly(this, "_network", network);
// Possible this call stacked so do not call defineReadOnly again
if (this._network == null) {
defineReadOnly(this, "_network", network);
}
}

return this._network;
Expand Down

0 comments on commit 8efd8d2

Please sign in to comment.