Add error check for GetCurrentSlot am: 1815c4dd52 am: 80bdc44943

Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2820039

Change-Id: If1d745ed46bbb19eb7ad0d47debc4ed2aefbac9f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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;