Avoid panic when account.source is None

This commit is contained in:
Michael Vines 2018-10-10 10:40:23 -07:00 committed by Grimes
parent c240bb12ae
commit 24a993710d
1 changed files with 3 additions and 1 deletions

View File

@ -327,7 +327,9 @@ impl TokenProgram {
Err(Error::InvalidArgument)?;
}
if Some(&delegate_account.source.unwrap()) != tx.key(pix, 1) {
if delegate_account.source.is_none()
|| Some(&delegate_account.source.unwrap()) != tx.key(pix, 1)
{
info!("account 2 is not a delegate of account 1");
Err(Error::InvalidArgument)?;
}