Added check to ensure passed surface data pointer is valid (non-zero/non-null).