Added a check for NULL values in array in the C++ abstraction layer

If there is NULL, throw an error message.