summaryrefslogtreecommitdiffstats
path: root/base/include/android-base/parseint.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/include/android-base/parseint.h')
-rw-r--r--base/include/android-base/parseint.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/base/include/android-base/parseint.h b/base/include/android-base/parseint.h
index fc68d56b4..bb54c99b8 100644
--- a/base/include/android-base/parseint.h
+++ b/base/include/android-base/parseint.h
@@ -47,7 +47,9 @@ bool ParseUint(const char* s, T* out, T max = std::numeric_limits<T>::max(),
if (max < result) {
return false;
}
- *out = static_cast<T>(result);
+ if (out != nullptr) {
+ *out = static_cast<T>(result);
+ }
return true;
}
@@ -87,7 +89,9 @@ bool ParseInt(const char* s, T* out,
if (result < min || max < result) {
return false;
}
- *out = static_cast<T>(result);
+ if (out != nullptr) {
+ *out = static_cast<T>(result);
+ }
return true;
}