Please note that in versions of the IDE up to and including 1.0.3, the String
library has bugs as discussed here
In particular, the dynamic memory allocation used by the String class may fail and cause random crashes.
I recommend reworking your code to manage without String. Use C-style strings instead (strcpy, strcat, strcmp, etc.), as described here
Alternatively, install the fix described here: Fixing String Crashes
Preferably upgrade your IDE to version 1.0.4 or above