diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-12-11 23:39:12 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-12-11 23:39:12 +0900 |
| commit | 79fce29bda0dadc5e970693c28ed6cd421ae9e95 (patch) | |
| tree | 0bf1dc66a5972cde56b51579e30af233fb8270f4 /src/BufferedFile.cc | |
| parent | e86fd44dc5a87d64efc18652b2833ae17b72bf10 (diff) | |
Fixed segmentation fault if fp_ is NULL
Diffstat (limited to 'src/BufferedFile.cc')
| -rw-r--r-- | src/BufferedFile.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/BufferedFile.cc b/src/BufferedFile.cc index b06ac3c6..f0096326 100644 --- a/src/BufferedFile.cc +++ b/src/BufferedFile.cc @@ -55,11 +55,11 @@ BufferedFile::BufferedFile(const char* filename, const char* mode) fp_(a2fopen(filename, mode)), #endif // !__MINGW32__ open_(fp_), - supportsColor_(isatty(fileno(fp_))) + supportsColor_(fp_ ? isatty(fileno(fp_)) : false) {} BufferedFile::BufferedFile(FILE* fp) - : fp_(fp), open_(true), supportsColor_(isatty(fileno(fp))) + : fp_(fp), open_(true), supportsColor_(fp_ ? isatty(fileno(fp_)) : false) {} BufferedFile::~BufferedFile() |
