src/lib/maf.c 1.39

1.39 2009/07/22 17:21:16 markd
fixed null pointer derefernces on i and e lines (from stanford); fix broken formatting
Index: src/lib/maf.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/lib/maf.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -b -B -U 4 -r1.38 -r1.39
--- src/lib/maf.c	27 Oct 2008 17:52:19 -0000	1.38
+++ src/lib/maf.c	22 Jul 2009 17:21:16 -0000	1.39
@@ -729,8 +729,9 @@
 {
 assert(col < maf->textSize);
 struct mafComp *comp;
 for (comp = maf->components; comp != NULL; comp = comp->next)
+    if (comp->text != NULL)
     {
     char c = comp->text[col];
     if (c != '.' && c != '-')
         return FALSE;
@@ -749,8 +750,9 @@
     if (!mafColumnEmpty(maf, readIx))
         {
 		for (comp = maf->components; comp != NULL; comp = comp->next) 
 			{
+            if(comp->text != NULL)
 		    comp->text[writeIx] = comp->text[readIx];
 			if (comp->quality != NULL)
 				comp->quality[writeIx] = comp->quality[readIx];
 			}
@@ -756,12 +758,12 @@
 			}
 		++writeIx;
 		}
     }
-
 /* Zero terminate text, and update textSize. */
 for (comp = maf->components; comp != NULL; comp = comp->next)
 	{
+    if (comp->text != NULL)
     comp->text[writeIx] = 0;
 	if (comp->quality != NULL)
 		comp->quality[writeIx] = 0;
 	}