Skip to content
Snippets Groups Projects
Commit 52bf757d authored by Danny Auble's avatar Danny Auble
Browse files

fix some potential seg faults

parent d55f5116
No related branches found
No related tags found
No related merge requests found
...@@ -126,6 +126,9 @@ extern void set_grid_inx(int start, int end, int count) ...@@ -126,6 +126,9 @@ extern void set_grid_inx(int start, int end, int count)
{ {
int i; int i;
if (!smap_system_ptr || !smap_system_ptr->grid)
return;
for (i = 0; i < smap_system_ptr->node_cnt; i++) { for (i = 0; i < smap_system_ptr->node_cnt; i++) {
if ((smap_system_ptr->grid[i]->index < start) || if ((smap_system_ptr->grid[i]->index < start) ||
(smap_system_ptr->grid[i]->index > end)) (smap_system_ptr->grid[i]->index > end))
...@@ -144,6 +147,9 @@ extern int set_grid_bg(int *start, int *end, int count, int set) ...@@ -144,6 +147,9 @@ extern int set_grid_bg(int *start, int *end, int count, int set)
{ {
int node_cnt = 0, i, j; int node_cnt = 0, i, j;
if (!smap_system_ptr || !smap_system_ptr->grid)
return 0;
for (i = 0; i < smap_system_ptr->node_cnt; i++) { for (i = 0; i < smap_system_ptr->node_cnt; i++) {
for (j = 0; j < params.cluster_dims; j++) { for (j = 0; j < params.cluster_dims; j++) {
if ((smap_system_ptr->grid[i]->coord[j] < start[j]) || if ((smap_system_ptr->grid[i]->coord[j] < start[j]) ||
...@@ -329,6 +335,9 @@ extern void print_grid(void) ...@@ -329,6 +335,9 @@ extern void print_grid(void)
{ {
int i; int i;
if (!smap_system_ptr || !smap_system_ptr->grid)
return;
for (i = 0; i < smap_system_ptr->node_cnt; i++) { for (i = 0; i < smap_system_ptr->node_cnt; i++) {
if (smap_system_ptr->grid[i]->color) if (smap_system_ptr->grid[i]->color)
init_pair(smap_system_ptr->grid[i]->color, init_pair(smap_system_ptr->grid[i]->color,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment