summaryrefslogtreecommitdiffstats
path: root/Source/cmFileMonitor.cxx
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-11-14 14:38:05 (GMT)
committerBrad King <brad.king@kitware.com>2016-11-14 15:18:44 (GMT)
commitd0a707b3d0c247d6bbf63fdfefc79d5ce0aea717 (patch)
tree34366577d24d45d0ee7adb8b893370c75a56a8ac /Source/cmFileMonitor.cxx
parent5cfc2e926af645840c6a0464451af18f08528879 (diff)
downloadCMake-d0a707b3d0c247d6bbf63fdfefc79d5ce0aea717.zip
CMake-d0a707b3d0c247d6bbf63fdfefc79d5ce0aea717.tar.gz
CMake-d0a707b3d0c247d6bbf63fdfefc79d5ce0aea717.tar.bz2
server-mode: Prevent possible crash when watching directories
The `filename` passed by libuv may be `nullptr`, so handle that explicitly. Fixes: #16422
Diffstat (limited to 'Source/cmFileMonitor.cxx')
-rw-r--r--Source/cmFileMonitor.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx
index 41ec8b4..ea37683 100644
--- a/Source/cmFileMonitor.cxx
+++ b/Source/cmFileMonitor.cxx
@@ -288,7 +288,7 @@ void on_directory_change(uv_fs_event_t* handle, const char* filename,
{
const cmIBaseWatcher* const watcher =
static_cast<const cmIBaseWatcher*>(handle->data);
- const std::string pathSegment(filename);
+ const std::string pathSegment(filename ? filename : "");
watcher->Trigger(pathSegment, events, status);
}