Skip to content

Commit

Permalink
* Minor segfault protection.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Aug 11, 2012
1 parent 2c78e79 commit b669e4e
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/tech.c
Expand Up @@ -810,6 +810,11 @@ Outfit** tech_getOutfit( tech_group_t *tech, int *n )
int m; int m;
Outfit **o; Outfit **o;


if (tech==NULL) {
*n = 0;
return NULL;
}

/* Get the outfits. */ /* Get the outfits. */
*n = 0; *n = 0;
m = 0; m = 0;
Expand Down Expand Up @@ -842,6 +847,11 @@ Outfit** tech_getOutfitArray( tech_group_t **tech, int num, int *n )
tech_group_t grp; tech_group_t grp;
Outfit **o; Outfit **o;


if (tech==NULL) {
*n = 0;
return NULL;
}

tech_createMetaGroup( &grp, tech, num ); tech_createMetaGroup( &grp, tech, num );
o = tech_getOutfit( &grp, n ); o = tech_getOutfit( &grp, n );
tech_freeGroup( &grp ); tech_freeGroup( &grp );
Expand All @@ -864,6 +874,11 @@ Ship** tech_getShip( tech_group_t *tech, int *n )
int m; int m;
Ship **s; Ship **s;


if (tech==NULL) {
*n = 0;
return NULL;
}

/* Get the outfits. */ /* Get the outfits. */
*n = 0; *n = 0;
m = 0; m = 0;
Expand Down Expand Up @@ -896,6 +911,11 @@ Ship** tech_getShipArray( tech_group_t **tech, int num, int *n )
tech_group_t grp; tech_group_t grp;
Ship **s; Ship **s;


if (tech==NULL) {
*n = 0;
return NULL;
}

tech_createMetaGroup( &grp, tech, num ); tech_createMetaGroup( &grp, tech, num );
s = tech_getShip( &grp, n ); s = tech_getShip( &grp, n );
tech_freeGroup( &grp ); tech_freeGroup( &grp );
Expand All @@ -919,6 +939,11 @@ Commodity** tech_getCommodityArray( tech_group_t **tech, int num, int *n )
tech_group_t grp; tech_group_t grp;
Commodity **c; Commodity **c;


if (tech==NULL) {
*n = 0;
return NULL;
}

tech_createMetaGroup( &grp, tech, num ); tech_createMetaGroup( &grp, tech, num );
c = tech_getCommodity( &grp, n ); c = tech_getCommodity( &grp, n );
tech_freeGroup( &grp ); tech_freeGroup( &grp );
Expand All @@ -941,6 +966,11 @@ Commodity** tech_getCommodity( tech_group_t *tech, int *n )
int m; int m;
Commodity **c; Commodity **c;


if (tech==NULL) {
*n = 0;
return NULL;
}

/* Get the commodities. */ /* Get the commodities. */
*n = 0; *n = 0;
m = 0; m = 0;
Expand Down

0 comments on commit b669e4e

Please sign in to comment.