Move off std::sto* function which abort on failure.
Bug: http://b/31403370
Test: builds, boots, libbase tests pass
Change-Id: I89cd7ca3d8f1c8a1bad0ddf3043439449d19a293
diff --git a/adb/bugreport.cpp b/adb/bugreport.cpp
index c348dd5..24be529 100644
--- a/adb/bugreport.cpp
+++ b/adb/bugreport.cpp
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
+#include <android-base/parseint.h>
#include <android-base/strings.h>
#include "sysdeps.h"
@@ -143,9 +144,11 @@
//
size_t idx1 = line.rfind(BUGZ_PROGRESS_PREFIX) + strlen(BUGZ_PROGRESS_PREFIX);
size_t idx2 = line.rfind(BUGZ_PROGRESS_SEPARATOR);
- int progress = std::stoi(line.substr(idx1, (idx2 - idx1)));
- int total = std::stoi(line.substr(idx2 + 1));
- br_->UpdateProgress(line_message_, progress, total);
+ int progress, total;
+ if (android::base::ParseInt(line.substr(idx1, (idx2 - idx1)), &progress) &&
+ android::base::ParseInt(line.substr(idx2 + 1), &total)) {
+ br_->UpdateProgress(line_message_, progress, total);
+ }
} else {
invalid_lines_.push_back(line);
}