bool MetadataBuilder::ValidatePartitionSizeChange(Partition* partition, uint64_t old_size,
uint64_t new_size, bool force_check) {
+ if (partition == nullptr) {
+ LERROR << "Partition is nullptr";
+ return false;
+ }
+
PartitionGroup* group = FindGroup(partition->group_name());
CHECK(group);
+ if (group == nullptr) {
+ LERROR << "Partition " << partition->name() << " does not exist";
+ return false;
+ }
if (!force_check && new_size <= old_size) {
return true;
bool MetadataBuilder::ResizePartition(Partition* partition, uint64_t requested_size,
const std::vector<Interval>& free_region_hint) {
+ if (partition == nullptr) {
+ LERROR << "Partition is nullptr";
+ return false;
+ }
+
// Align the space needed up to the nearest sector.
uint64_t aligned_size;
if (!AlignTo(requested_size, geometry_.logical_block_size, &aligned_size)) {