aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2023-01-18 18:00:13 -0800
committerCole Faust <colecfaust@gmail.com>2023-01-18 18:17:33 -0800
commit535ec5d0d6991e647087a8e411d737163a31603a (patch)
tree579c5493692933e5bce7fed0f167148b17c9e9c0
parent462b39477dc01a66dca59af85d8b50aeae100bb8 (diff)
downloadkati-535ec5d0d6991e647087a8e411d737163a31603a.tar.gz
Fix crash due to std::string_view change
std::string_view can't accept a null pointer.
-rw-r--r--src/regen.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/regen.cc b/src/regen.cc
index 0f2bb1c..458c4cd 100644
--- a/src/regen.cc
+++ b/src/regen.cc
@@ -202,7 +202,8 @@ class StampChecker {
int num_envs = LOAD_INT(fp);
for (int i = 0; i < num_envs; i++) {
LOAD_STRING(fp, &s);
- std::string_view val(getenv(s.c_str()));
+ const char* val_c_str = getenv(s.c_str());
+ std::string_view val(val_c_str ? val_c_str : "");
LOAD_STRING(fp, &s2);
if (val != s2) {
if (g_flags.dump_kati_stamp) {