From 2cfc6259971f53af45e57de1117f6a1f345a7b23 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 3 Nov 2014 09:23:17 +0000 Subject: coverity#1209713 Dereference null return value Change-Id: I8aba67ae5bf5ffb7530be8f6d5b2511b554717db --- hwpfilter/source/hcode.cxx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'hwpfilter') diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index 93f5f0ff72ca..42b7205824b2 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -1309,8 +1309,12 @@ char *hcolor2str(uchar color, uchar shade, char *buf, bool bIsChar) if( src[0] == 'C' && src[1] == ':' && src[2] == '\\' ) // Home Dir { ret.append("file://"); - ret.append(getenv("HOME")); - ret.push_back('/'); + const char *pHome = getenv("HOME"); + if (pHome) + { + ret.append(pHome); + ret.push_back('/'); + } i = 3; // skip first 3 } else if( src[0] == 'D' && src[1] == ':' && src[2] == '\\' ) // Root Dir -- cgit