@@ -164,13 +164,14 @@ public bool ProcessNoMissing(ICompareService comparer, string pass, BIP0032Path
164164 if ( path is null )
165165 {
166166 message += Environment . NewLine ;
167- message += "Derivation path is not set ." ;
167+ message += "Set the derivation path correctly to verify the derived key/address ." ;
168168 return true ; // The mnemonic is valid, we just can't derive child keys to do extra checks
169169 }
170170
171171 if ( comparer is null || ! comparer . IsInitialized )
172172 {
173- message = "Set the compare value correctly to verify the derived key/address." ;
173+ message += Environment . NewLine ;
174+ message += "Set the compare value correctly to verify the derived key/address." ;
174175 return true ; // Same as above
175176 }
176177
@@ -180,17 +181,26 @@ public bool ProcessNoMissing(ICompareService comparer, string pass, BIP0032Path
180181 BIP0032Path newPath = new ( indices ) ;
181182
182183 PrivateKey [ ] keys = temp . GetPrivateKeys ( newPath , 1 , startIndex ) ;
184+ if ( keys is null || keys . Length < 1 )
185+ {
186+ // The chance of this happening is _nearly_ zero
187+ message += Environment . NewLine ;
188+ message += "Could not derive any keys at the given path." ;
189+ return false ;
190+ }
191+
183192 if ( comparer . Compare ( keys [ 0 ] . ToBytes ( ) ) )
184193 {
185194 message += Environment . NewLine ;
186- message += $ "The given child key is correctly derived from this mnemonic at { path } path. ";
195+ message += $ "The given child key is correctly derived from this mnemonic at { path } ";
187196 return true ;
188197 }
189198 else
190199 {
191200 message += Environment . NewLine ;
192- message += $ "The given child key is not derived from this mnemonic or not at { path } path.";
193- message += $ "List of all address types that can be derived from this mnemonic at the given path:" +
201+ message += $ "The given child key is not derived from this mnemonic or not at { path } ";
202+ message += $ "{ Environment . NewLine } " +
203+ $ "List of all address types that can be derived from this mnemonic at the given path:" +
194204 $ "{ Environment . NewLine } " +
195205 $ "{ AddressService . GetAllAddresses ( keys [ 0 ] . ToPublicKey ( comparer . Calc ) ) } ";
196206 return false ;
0 commit comments