Added some error checking when opening or creating a view
This commit is contained in:
@ -1567,7 +1567,23 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name)
|
|||||||
OBIDMS_column_p column_pointer;
|
OBIDMS_column_p column_pointer;
|
||||||
int i;
|
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));
|
view = (Obiview_p) malloc(sizeof(Obiview_t));
|
||||||
if (view == NULL)
|
if (view == NULL)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user