From 2aa8b6c9712f882329c5620c33d69b88ba5a7fdc Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 12 Jan 2024 12:10:26 +0200 Subject: [PATCH] Check fd_ is not nullptr in file_helper --- include/spdlog/details/file_helper-inl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/spdlog/details/file_helper-inl.h b/include/spdlog/details/file_helper-inl.h index 97215f50..69af9b6a 100644 --- a/include/spdlog/details/file_helper-inl.h +++ b/include/spdlog/details/file_helper-inl.h @@ -98,6 +98,7 @@ SPDLOG_INLINE void file_helper::close() { } SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf) { + if(fd_ == nullptr) return; size_t msg_size = buf.size(); auto data = buf.data(); if (std::fwrite(data, 1, msg_size, fd_) != msg_size) {