Skip to content

Commit b9ff9fa

Browse files
author
ivelin
committed
fix: load peer ID from an empty file
1 parent 981ae27 commit b9ff9fa

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/peerjs/ext/http_proxy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,17 @@ def _savePeerId(peerId=None):
9292

9393

9494
def _loadPeerId():
95+
"""Load and reuse saved peer ID if there is one."""
9596
global savedPeerId
9697
conf_file = Path(PEERID_FILE)
9798
if conf_file.exists():
9899
conf = {}
99100
with conf_file.open() as infile:
100101
conf = yaml.load(infile)
101-
savedPeerId = conf.get('peerId', None)
102-
102+
if conf is not None:
103+
savedPeerId = conf.get('peerId', None)
104+
else:
105+
savedPeerId = None
103106

104107
def _loadConfig():
105108
global config

0 commit comments

Comments
 (0)