Below I try to use strcmp to compare svr_type to a constant string array. Occasionally this produces a NullReferenceException. I put in a try catch just so I could get the full error and this is what I got:
System.NullReferenceException: Object reference not set to an instance of an object.
at strcmp(SByte* , SByte* )
I'm not entirely sure why. getNextWord modifies the input string and returns a pointer to a new char[30] so the memory must be allocated.
Any ideas?
- iknc4miles
Expand|Select|Wrap|Line Numbers
- try
- {
- char* svr_type;
- svr_type = getNextWord(&str);
- if( strcmp(svr_type, "ALG") == 0)
- {
- // Does Algorithm server already exist?
- }
- else if(strcmp(svr_type, "ENV") == 0)
- {
- // Does Environment server already exist?
- }
- }
- catch(NullReferenceException *e)
- {
- tbLog->AppendText(e->ToString());
- return;
- }