From 2f26ae3fc68a9436ecfcb58d527c3206fa3cd7dd Mon Sep 17 00:00:00 2001 From: Jarle Ladstein Date: Fri, 10 Jan 2014 10:38:58 +0100 Subject: [PATCH] Do not call nc_close on null object in NcFile destructor --- cxx4/ncFile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cxx4/ncFile.cpp b/cxx4/ncFile.cpp index d6db805..9a7fe55 100644 --- a/cxx4/ncFile.cpp +++ b/cxx4/ncFile.cpp @@ -17,7 +17,8 @@ NcFile::~NcFile() // causes undefined behaviour! so just printing a warning message try { - ncCheck(nc_close(myId),__FILE__,__LINE__); + if (!nullObject) + ncCheck(nc_close(myId),__FILE__,__LINE__); } catch (NcException &e) {