Skip to content

Commit 9cd149d

Browse files
massjhunsaker
authored andcommitted
manager: Set error state if program key is not found.
Previously, the code would crash here.
1 parent 2c1197a commit 9cd149d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pc/manager.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,15 @@ void manager::reconnect_rpc()
518518
clnt_.send( sreq_ );
519519

520520
// subscribe to program updates
521-
preq_->set_commitment( get_commitment() );
522-
preq_->set_program( get_program_pub_key() );
523-
clnt_.send( preq_ );
521+
pub_key *gpub = get_program_pub_key();
522+
if ( !gpub ) {
523+
set_err_msg( "missing or invalid program public key [" +
524+
get_program_pub_key_file() + "]" );
525+
} else {
526+
preq_->set_commitment( get_commitment() );
527+
preq_->set_program( gpub );
528+
clnt_.send( preq_ );
529+
}
524530

525531
// gather latest info on mapping accounts
526532
for( get_mapping *mptr: mvec_ ) {

0 commit comments

Comments
 (0)