Add error check for GetCurrentSlot
Test: th
Bug: 309039765
Change-Id: I5f5e7e0367cf0b09b12d83dd9e53224a09858bd1
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index d7cb2d2..ea83d9a 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -638,6 +638,14 @@
ErrorCode errorcode{};
BootControlInterface::Slot current_slot = GetCurrentSlot();
+ if (current_slot < 0) {
+ return LogAndSetError(
+ error,
+ __LINE__,
+ __FILE__,
+ "Failed to get current slot " + std::to_string(current_slot),
+ ErrorCode::kDownloadStateInitializationError);
+ }
for (const PartitionUpdate& partition : manifest.partitions()) {
if (!partition.has_old_partition_info())
continue;