Fixed a bug where an unmapped variable would be read
This commit is contained in:
@ -350,8 +350,9 @@ OBIDMS_column_p clone_column_in_view(Obiview_p view, const char* column_name)
|
|||||||
obi_close_column(column_buffer);
|
obi_close_column(column_buffer);
|
||||||
|
|
||||||
if (!(strcmp((((view->columns)[i])->header)->name, column_name)))
|
if (!(strcmp((((view->columns)[i])->header)->name, column_name)))
|
||||||
// Found the column to return
|
{ // Found the column to return
|
||||||
column = (view->columns)[i];
|
column = (view->columns)[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,6 +374,8 @@ OBIDMS_column_p clone_column_in_view(Obiview_p view, const char* column_name)
|
|||||||
|
|
||||||
int prepare_to_set_value_in_column(Obiview_p view, OBIDMS_column_p* column_pp, index_t* line_nb_p)
|
int prepare_to_set_value_in_column(Obiview_p view, OBIDMS_column_p* column_pp, index_t* line_nb_p)
|
||||||
{
|
{
|
||||||
|
char* column_name;
|
||||||
|
|
||||||
// Check that the view is not read-only
|
// Check that the view is not read-only
|
||||||
if (view->read_only)
|
if (view->read_only)
|
||||||
{
|
{
|
||||||
@ -389,12 +392,22 @@ int prepare_to_set_value_in_column(Obiview_p view, OBIDMS_column_p* column_pp, i
|
|||||||
if (view->line_selection != NULL)
|
if (view->line_selection != NULL)
|
||||||
(*line_nb_p) = *(((index_t*) ((view->line_selection)->data)) + (*line_nb_p));
|
(*line_nb_p) = *(((index_t*) ((view->line_selection)->data)) + (*line_nb_p));
|
||||||
|
|
||||||
(*column_pp) = clone_column_in_view(view, ((*column_pp)->header)->name);
|
column_name = (char*) malloc(strlen(((*column_pp)->header)->name) * sizeof(char));
|
||||||
|
if (column_name == NULL)
|
||||||
|
{
|
||||||
|
obi_set_errno(OBI_MALLOC_ERROR);
|
||||||
|
obidebug(1, "\nError trying to allocate memory for a column name");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
strcpy(column_name, ((*column_pp)->header)->name);
|
||||||
|
(*column_pp) = clone_column_in_view(view, column_name);
|
||||||
if ((*column_pp) == NULL)
|
if ((*column_pp) == NULL)
|
||||||
{
|
{
|
||||||
obidebug(1, "\nError trying to clone a column to modify it");
|
obidebug(1, "\nError trying to clone a column to modify it");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(column_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((*line_nb_p)+1) > view->line_count)
|
if (((*line_nb_p)+1) > view->line_count)
|
||||||
|
Reference in New Issue
Block a user