Skip to content

Commit 9c9f29b

Browse files
committed
COMP: Report build error if vtkMRMLCopyVectorMacro argument is missing
Missing vtkMRMLCopyVectorMacro arguments caused build errors on Mac but not with VisualStudio, because VisualStudio ignores if an unused macro argument is missing. Made the behavior consistent on all compilers by using the vectorType argument. vectorSize argument is still not used, but it should rarely happen that somebody just removes vectorSize and not the vectorType argument when copy-pasting. git-svn-id: http://svn.slicer.org/Slicer4/trunk@26934 3bd1e089-480b-0410-8dfb-8563597acbee
1 parent 1befad3 commit 9c9f29b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Libs/MRML/Core/vtkMRMLNodePropertyMacros.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,19 @@
257257

258258
/// Macro for copying floating-point (float or double) vector node property value.
259259
#define vtkMRMLCopyVectorMacro(propertyName, vectorType, vectorSize) \
260-
this->Set##propertyName(this->SafeDownCast(copySourceNode)->Get##propertyName());
260+
{ \
261+
/* Currently, vectorType and vectorSize is not essential, but in the future */ \
262+
/* this information may be used more. */ \
263+
vectorType* sourceVector = this->SafeDownCast(copySourceNode)->Get##propertyName(); \
264+
if (sourceVector != NULL) \
265+
{ \
266+
this->Set##propertyName(sourceVector); \
267+
} \
268+
else \
269+
{ \
270+
vtkErrorMacro("Failed to copy #xmlAttributeName attribute value: source node returned NULL"); \
271+
} \
272+
}
261273

262274
/// @}
263275

0 commit comments

Comments
 (0)