8bf387183308af2ccd05188c723db5e5ee984e37
braney
  Wed Apr 30 15:52:15 2014 -0700
fix bug where multiWigs crashed with only zero or one subtracks turnedon

diff --git src/hg/hgTracks/wigTrack.c src/hg/hgTracks/wigTrack.c
index 8b5c513..7bb2568 100644
--- src/hg/hgTracks/wigTrack.c
+++ src/hg/hgTracks/wigTrack.c
@@ -795,30 +795,31 @@
 rgbColor.r = (2*rgbColor.r+255)/3;
 rgbColor.g = (2*rgbColor.g+255)/3;
 rgbColor.b = (2*rgbColor.b+255)/3;
 return MAKECOLOR_32(rgbColor.r, rgbColor.g, rgbColor.b);
 }
 
 struct wigGraphOutput *wigGraphOutputStack(int xOff, int yOff,  int width, int numTracks, struct hvGfx *image)
 /* Get appropriate wigGraphOutput for non-transparent stacked rendering */
 {
 struct wigGraphOutput *wgo;
 AllocVar(wgo);
 wgo->image = image;
 wgo->vLine = vLineViaHvg;
 wgo->xOff = xOff;
 wgo->yOff = yOff;
+if (numTracks)
     wgo->yOffsets = needHugeMem(width * numTracks * sizeof(double));
 return wgo;
 }
 
 struct wigGraphOutput *wigGraphOutputSolid(int xOff, int yOff, struct hvGfx *image)
 /* Get appropriate wigGraphOutput for non-transparent rendering */
 {
 struct wigGraphOutput *wgo;
 AllocVar(wgo);
 wgo->image = image;
 wgo->vLine = vLineViaHvg;
 wgo->xOff = xOff;
 wgo->yOff = yOff;
 return wgo;
 }