Skip to content

Commit

Permalink
fix: load peer ID from an empty file
Browse files Browse the repository at this point in the history
Merge pull request ambianic#52 from ivelin/master
  • Loading branch information
Ivelin Ivanov authored Jan 23, 2021
2 parents 581923c + b9ff9fa commit 4cfe6fb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/peerjs/ext/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,17 @@ def _savePeerId(peerId=None):


def _loadPeerId():
"""Load and reuse saved peer ID if there is one."""
global savedPeerId
conf_file = Path(PEERID_FILE)
if conf_file.exists():
conf = {}
with conf_file.open() as infile:
conf = yaml.load(infile)
savedPeerId = conf.get('peerId', None)

if conf is not None:
savedPeerId = conf.get('peerId', None)
else:
savedPeerId = None

def _loadConfig():
global config
Expand Down

0 comments on commit 4cfe6fb

Please sign in to comment.