buffer[i] = customKeypad.getKey();
What did you store here if no key was pressed? Why do you want to store that?
if (buffer[i] == '\0')
This is a rather poor test. The getKey() function returns a #defined value, NO_KEY, when no key is pressed. Assuming that NO_KEY is equivalent to NULL is a poor assumption.