Handle missing identity file in rncp. Fixes #317.

pull/325/head
Mark Qvist 2023-05-31 15:39:55 +02:00
rodzic 45295c779c
commit a8a7af4b74
2 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -452,7 +452,7 @@ class Identity:
return False
except Exception as e:
RNS.log("Error while loading identity from "+str(path), RNS.LOG_ERROR)
RNS.log("The contained exception was: "+str(e))
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
def get_salt(self):
return self.hash

Wyświetl plik

@ -226,7 +226,12 @@ def send(configdir, verbosity = 0, quietness = 0, destination = None, file = Non
identity_path = RNS.Reticulum.identitypath+"/"+APP_NAME
if os.path.isfile(identity_path):
identity = RNS.Identity.from_file(identity_path)
identity = RNS.Identity.from_file(identity_path)
if identity == None:
RNS.log("Could not load identity for rncp. The identity file at \""+str(identity_path)+"\" may be corrupt or unreadable.", RNS.LOG_ERROR)
exit(2)
else:
identity = None
if identity == None:
RNS.log("No valid saved identity found, creating new...", RNS.LOG_INFO)