diff options
author | Dino Radakovic <dinor@google.com> | 2022-05-17 15:21:04 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-05-17 15:22:17 -0700 |
commit | e92505d8d6bf50c5d44805eb5fe73e9f56484cf4 (patch) | |
tree | 15337c58ec034ea36d84701fbda295a2fa9f7616 /absl/strings/str_cat.h | |
parent | 7d3b4c86928ff7b17b3b881d42355062c23f6b44 (diff) |
Use NullSafeStringView for const char* args to absl::StrCat, treating null pointers as ""
Fixes #1167
PiperOrigin-RevId: 449328725
Change-Id: I813785db77b94efa49eeeff4c93449334c380935
Diffstat (limited to 'absl/strings/str_cat.h')
-rw-r--r-- | absl/strings/str_cat.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/absl/strings/str_cat.h b/absl/strings/str_cat.h index 4d228b09..a94bc5df 100644 --- a/absl/strings/str_cat.h +++ b/absl/strings/str_cat.h @@ -251,7 +251,8 @@ class AlphaNum { const strings_internal::AlphaNumBuffer<size>& buf) : piece_(&buf.data[0], buf.size) {} - AlphaNum(const char* c_str) : piece_(c_str) {} // NOLINT(runtime/explicit) + AlphaNum(const char* c_str) // NOLINT(runtime/explicit) + : piece_(NullSafeStringView(c_str)) {} // NOLINT(runtime/explicit) AlphaNum(absl::string_view pc) : piece_(pc) {} // NOLINT(runtime/explicit) template <typename Allocator> |