@@ -40,6 +40,7 @@ static int VertexCB(p_ply_argument argument) {
4040 ply_get_argument_user_data (argument, &userData, &userIndex);
4141
4242 Point *p = *static_cast <Point **> (userData);
43+ if (!p) return 1 ;
4344
4445 long vertIndex;
4546 ply_get_argument_element (argument, nullptr , &vertIndex);
@@ -65,6 +66,7 @@ static int NormalCB(p_ply_argument argument) {
6566 ply_get_argument_user_data (argument, &userData, &userIndex);
6667
6768 Normal *n = *static_cast <Normal **> (userData);
69+ if (!n) return 1 ;
6870
6971 long normIndex;
7072 ply_get_argument_element (argument, nullptr , &normIndex);
@@ -89,6 +91,7 @@ static int UVCB(p_ply_argument argument) {
8991 ply_get_argument_user_data (argument, &userData, &userIndex);
9092
9193 UV *uv = *static_cast <UV **> (userData);
94+ if (!uv) return 1 ;
9295
9396 long uvIndex;
9497 ply_get_argument_element (argument, nullptr , &uvIndex);
@@ -110,6 +113,7 @@ static int ColorCB(p_ply_argument argument) {
110113 ply_get_argument_user_data (argument, &userData, &userIndex);
111114
112115 float *c = *static_cast <float **> (userData);
116+ if (!c) return 1 ;
113117
114118 long colIndex;
115119 ply_get_argument_element (argument, nullptr , &colIndex);
@@ -151,6 +155,7 @@ static int AlphaCB(p_ply_argument argument) {
151155 ply_get_argument_user_data (argument, &userData, &userIndex);
152156
153157 float *c = *static_cast <float **> (userData);
158+ if (!c) return 1 ;
154159
155160 long alphaIndex;
156161 ply_get_argument_element (argument, nullptr , &alphaIndex);
@@ -180,6 +185,7 @@ static int VertexAOVCB(p_ply_argument argument) {
180185 ply_get_argument_user_data (argument, &userData, &userIndex);
181186
182187 float *c = *static_cast <float **> (userData);
188+ if (!c) return 1 ;
183189
184190 long alphaIndex;
185191 ply_get_argument_element (argument, nullptr , &alphaIndex);
0 commit comments