[comp.soft-sys.andrew] "ez" drops core when run with no supported window system

guy@auspex.auspex.com (Guy Harris) (03/27/91)

If you're not running under WM nor X (nor any other window system to
which you've added support), and try to fire up an "ez", it drops core. 
The problem is that it's not as careful checking for failure returns as
it could be.

Here's a fix, to "atk/ez/eza.c":

*** eza.c.dist	Thu Jan  3 14:58:23 1991
--- eza.c	Tue Mar 26 20:12:37 1991
***************
*** 454,466 ****
  	    Dont have a window yet, or need one for error buffer.
  	*/
  
! 	self->frame = frame_New();
  	frame_SetCommandEnable(self->frame, TRUE);
          if (self->haveBufferInWindow)
              frame_SetTitle(self->frame, "Startup Errors.");
          else
              frame_SetTitle(self->frame, "No files specified."); /* This will get reset below. */
! 	self->im = im_Create(NULL);
  	im_SetView(self->im, self->frame);
  	frame_PostDefaultHandler(self->frame, "message", frame_WantHandler(self->frame, "message"));
      }
--- 454,472 ----
  	    Dont have a window yet, or need one for error buffer.
  	*/
  
! 	if((self->frame = frame_New()) == NULL) {
! 	    fprintf(stderr,"Could not allocate enough memory.\nexiting.\n");
! 	    return(FALSE);
! 	}
  	frame_SetCommandEnable(self->frame, TRUE);
          if (self->haveBufferInWindow)
              frame_SetTitle(self->frame, "Startup Errors.");
          else
              frame_SetTitle(self->frame, "No files specified."); /* This will get reset below. */
! 	if((self->im = im_Create(NULL)) == NULL) {
! 	    fprintf(stderr,"Could not create new window.\nexiting.\n");
! 	    return(FALSE);
! 	}
  	im_SetView(self->im, self->frame);
  	frame_PostDefaultHandler(self->frame, "message", frame_WantHandler(self->frame, "message"));
      }