I am working on a subroutine for an assembler and I am getting a segmentation fault and I'm not too sure why or what is causing it. I thought it might be my extern statements, but the issue still arises when I comment those out. Any ideas?

Code:
/* Pre-Processor Directives */
#ifndef SYMBSIZE
   #define SYMBSIZE 10
#endif

typedef struct tablemem
{
   char symbol[SYMBSIZE];
   int value;   
   int casenmbr; 
   int otherinfo;
} tabletype;

extern tabletype codetable[];
extern int codetabsize;  

int opcodeincr(int tablindx, int ni, int xbpe)
{
   int incr = -1, eBit = xbpe;
   int caseNum = codetable[tablindx].casenmbr;
   
   /* Find what the e-bit is set to */
   if(eBit > 7) 
      eBit -= 8;
   if(eBit > 3) 
      eBit -= 4;
   if(eBit > 1)           
      eBit -= 2;
   
   /* 2-byte cases */
   if(caseNum == 2 || caseNum == 3 || caseNum == 4)
      if(eBit == 0)
         incr = 2;
   
   /* 3 or 4 byte cases */
   if(caseNum == 1)
      if(eBit == 1)
         incr = 4;
      else
         incr = 3;
   
   /* 0-byte cases */
   if(caseNum == 10 || caseNum == 11 || caseNum == 20 || caseNum == 21 ||
      caseNum == 30 || caseNum == 40 || caseNum == 41 || caseNum >= 50)
      if(eBit == 0)
         incr = 0;
   
   return incr;
}