Added some error checking when opening or creating a view

This commit is contained in:
Celine Mercier
2016-09-28 14:28:34 +02:00
parent b717e8bb8b
commit 1a7b42018e

View File

@ -1567,7 +1567,23 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name)
OBIDMS_column_p column_pointer;
int i;
// Alllocate the memory for the view structure
// Check that the DMS is a valid pointer
if (dms == NULL)
{
obi_set_errno(OBIVIEW_ERROR);
obidebug(1, "\nError opening a view: DMS pointer is NULL");
return NULL;
}
// Check that the view name pointer is valid
if (view_name == NULL)
{
obi_set_errno(OBIVIEW_ERROR);
obidebug(1, "\nError opening a view: view name is NULL");
return NULL;
}
// Allocate the memory for the view structure
view = (Obiview_p) malloc(sizeof(Obiview_t));
if (view == NULL)
{