diff options
author | Cole Faust <colefaust@google.com> | 2023-01-18 18:00:13 -0800 |
---|---|---|
committer | Cole Faust <colecfaust@gmail.com> | 2023-01-18 18:17:33 -0800 |
commit | 535ec5d0d6991e647087a8e411d737163a31603a (patch) | |
tree | 579c5493692933e5bce7fed0f167148b17c9e9c0 | |
parent | 462b39477dc01a66dca59af85d8b50aeae100bb8 (diff) | |
download | kati-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.cc | 3 |
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) { |