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

@ -1561,13 +1561,29 @@ int obi_view_unmap_file(OBIDMS_p dms, Obiview_infos_p view_infos)
Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name)
{
Obiview_p view;
const char* column_name;
obiversion_t column_version;
OBIDMS_column_p column_pointer;
int i;
Obiview_p view;
const char* column_name;
obiversion_t column_version;
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)
{