Added some error checking when opening or creating a view
This commit is contained in:
@ -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 obi_open_view(OBIDMS_p dms, const char* view_name)
|
||||||
{
|
{
|
||||||
Obiview_p view;
|
Obiview_p view;
|
||||||
const char* column_name;
|
const char* column_name;
|
||||||
obiversion_t column_version;
|
obiversion_t column_version;
|
||||||
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