First of all, use i<50 instead of i<49.
If the line you have pointed out is really the line where it crashes, the only thing I could imagine is that you may have changed next1 itself, like next1 = NULL; // without []-brackets