Skip to content

Commit 80f0b60

Browse files
alanshawJacob Heun
authored andcommitted
fix: add null property guards
License: MIT Signed-off-by: Alan Shaw <[email protected]>
1 parent ac5cacb commit 80f0b60

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class Node extends EventEmitter {
3434
this.peerInfo = _options.peerInfo
3535
this.peerBook = _options.peerBook || new PeerBook()
3636

37-
this._modules = _options.modules
38-
this._config = _options.config
37+
this._modules = _options.modules || {}
38+
this._config = _options.config || {}
3939
this._isStarted = false
4040
this._transport = [] // Transport instances/references
4141
this._discovery = [] // Discovery service instances/references
@@ -76,7 +76,7 @@ class Node extends EventEmitter {
7676
}
7777

7878
// dht provided components (peerRouting, contentRouting, dht)
79-
if (this._config.EXPERIMENTAL.dht) {
79+
if (this._config.EXPERIMENTAL && this._config.EXPERIMENTAL.dht) {
8080
const DHT = this._modules.dht
8181
this._dht = new DHT(this._switch, {
8282
kBucketSize: this._config.dht.kBucketSize || 20,

0 commit comments

Comments
 (0)