addObjectSubmenu[i] = glutCreateMenu(processObjectEvents);\r
int startNum = i*11 - (i-1);\r
for ( int j = startNum - 1; j < (startNum+9); j++ ) {\r
- if ( !objectMenuEntries[j] ) break; // Detect if we've reached the end of the array\r
+ if ( j == objectMenuEntriesSize ) break; // Detect if we've reached the end of the array\r
glutAddMenuEntry( objectMenuEntries[j], j );\r
}\r
}\r