mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
Validate the value of a UserStatusDirective read from disk.
Summary: Follow-up work from D4181868. Reviewed By: simpkins Differential Revision: D4256227 fbshipit-source-id: 3e40a0cae4ab132046d96029d2881c2127ed4c83
This commit is contained in:
parent
0e613bd96b
commit
1cd336846e
@ -49,7 +49,13 @@ DirstatePersistence::load() {
|
||||
auto dirstateData =
|
||||
CompactSerializer::deserialize<overlay::DirstateData>(serializedData);
|
||||
for (auto& pair : dirstateData.directives) {
|
||||
entries[RelativePath(pair.first)] = pair.second;
|
||||
auto name = overlay::_UserStatusDirective_VALUES_TO_NAMES.find(pair.second);
|
||||
if (name != overlay::_UserStatusDirective_VALUES_TO_NAMES.end()) {
|
||||
entries[RelativePath(pair.first)] = pair.second;
|
||||
} else {
|
||||
throw std::runtime_error(folly::to<std::string>(
|
||||
"Illegal enum value for UserStatusDirective: ", pair.second));
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
|
Loading…
Reference in New Issue
Block a user