I have 2 legacy wallets and on both if I run `upgradewallet` it will cause bitcoin core to crash. This should just return me an error string

Currenl result from `getwalletinfo`:
```
{
  "walletname": "Wallet",
  "walletversion": 169900,
  "format": "bdb",
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 80,
  "keypoololdest": 1613078825,
  "keypoolsize": 941,
  "keypoolsize_hd_internal": 941,
  "paytxfee": 0.00000000,
  "private_keys_enabled": false,
  "avoid_reuse": true,
  "scanning": false,
  "descriptors": false
}
```
{
    LOCK(cs_KeyStore);
    if (!m_storage.HasEncryptionKeys()) {
        return FillableSigningProvider::GetKeys();
    }
    std::set<CKeyID> set_address;
    for (const auto& mi : mapCryptedKeys) {
        set_address.insert(mi.first);
    }
    return set_address;
}
bool DescriptorScriptPubKeyMan::GetNewDestination(const OutputType type, CTxDestination& dest, bilingual_str& error)
{
    
    if (!CanGetAddresses()) {
        error = _("No addresses available");
        return false;
    }
    {
        LOCK(cs_desc_man);
        assert(m_wallet_descriptor.descriptor->IsSingleType()); 
        std::optional<OutputType> desc_addr_type = m_wallet_descriptor.descriptor->GetOutputType();
        assert(desc_addr_type);
        if (type != *desc_addr_type) {
            throw std::runtime_error(std::string(__func__) + ": Types are inconsistent");
        }
        TopUp();
        
        FlatSigningProvider out_keys;
        std::vector<CScript> scripts_temp;