diff --git a/src/governance/validators.cpp b/src/governance/validators.cpp index 191012afbc..421ea86055 100644 --- a/src/governance/validators.cpp +++ b/src/governance/validators.cpp @@ -98,6 +98,11 @@ bool CProposalValidator::ValidateName() return false; } + if (strName.empty()) { + strErrorMessages += "name cannot be empty;"; + return false; + } + static constexpr std::string_view strAllowedChars{"-_abcdefghijklmnopqrstuvwxyz0123456789"}; strName = ToLower(strName); diff --git a/src/test/data/proposals_invalid.json b/src/test/data/proposals_invalid.json index 79fa959c8b..2159e7df1b 100644 --- a/src/test/data/proposals_invalid.json +++ b/src/test/data/proposals_invalid.json @@ -16,5 +16,6 @@ {"end_epoch": 1491368400, "name": "dean-miller-5493", "payment_address": "XpG61qAVhdyN7AqVZQsHfJL7AEk4dPVinc", "payment_amount": "25.75", "start_epoch": 1474261086, "type": 1, "url": "http://dashcentral.org/dean-miller-5493"}, {"end_epoch": "1491368400", "name": "dean-miller-5493", "payment_address": "XpG61qAVhdyN7AqVZQsHfJL7AEk4dPVinc", "payment_amount": 25.75, "start_epoch": 1474261086, "type": 1, "url": "http://dashcentral.org/dean-miller-5493"}, {"end_epoch": 1491368400, "name": "dean-miller-5493", "payment_address": "XpG61qAVhdyN7AqVZQsHfJL7AEk4dPVinc", "payment_amount": 25.75, "start_epoch": "1474261086", "type": 1, "url": "http://dashcentral.org/dean-miller-5493"}, -{"end_epoch": 1491368400, "name": "dean-miller-5493", "payment_address": "XpG61qAVhdyN7AqVZQsHfJL7AEk4dPVinc", "payment_amount": 25.75, "start_epoch": 1474261086, "type": 2, "url": "http://dashcentral.org/dean-miller-5493"} +{"end_epoch": 1491368400, "name": "dean-miller-5493", "payment_address": "XpG61qAVhdyN7AqVZQsHfJL7AEk4dPVinc", "payment_amount": 25.75, "start_epoch": 1474261086, "type": 2, "url": "http://dashcentral.org/dean-miller-5493"}, +{"end_epoch": 1491368400, "name": "", "payment_address": "XpG61qAVhdyN7AqVZQsHfJL7AEk4dPVinc", "payment_amount": 25.75, "start_epoch": 1474261086, "type": 1, "url": "http://dashcentral.org/dean-miller-5493"} ]