mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
Catch invalid network names in IdentityFromString/LinkAccounts
This commit is contained in:
parent
3e88744e3b
commit
db727c9329
2 changed files with 8 additions and 1 deletions
|
@ -163,7 +163,11 @@ def LinkAccount(link,cmd):
|
|||
if linked_identity == None:
|
||||
link.send('usage: !link_account [<network>:]<username>')
|
||||
return
|
||||
linked_identity=IdentityFromString(link,linked_identity)
|
||||
try:
|
||||
linked_identity=IdentityFromString(link,linked_identity)
|
||||
except Exception,e:
|
||||
link.send('%s is invalid' % linked_identity)
|
||||
return
|
||||
ok,reason=LinkCore(link,linked_identity)
|
||||
if not ok:
|
||||
link.send('An error occured')
|
||||
|
|
|
@ -381,6 +381,9 @@ def IdentityFromString(link,s):
|
|||
parts=s.split(':')
|
||||
network_name=parts[0]
|
||||
network=GetNetworkByName(network_name)
|
||||
if not network:
|
||||
log_error('unknown network: %s' % network_name)
|
||||
raise RuntimeError('Unknown network: %s' % network_name)
|
||||
nick=parts[1]
|
||||
return network.name+':'+network.canonicalize(nick)
|
||||
|
||||
|
|
Loading…
Reference in a new issue