[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Printing to STDERR when %d is "Cannot access memory ..."
From: |
Keith David Bershatsky |
Subject: |
Re: Printing to STDERR when %d is "Cannot access memory ..." |
Date: |
Wed, 13 Jun 2018 12:34:01 -0700 |
Thank you, Davis, for teaching me how to deal with a NULL pointer when printing
to STDERR. Your code works well. Greatly appreciated!
Keith
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DATE: [06-13-2018 11:50:13] <13 Jun 2018 12:50:13 -0600>
FROM: Davis Herring <address@hidden>
>
> > fprintf (stderr, "(%d)", (font->space_width == NULL
> > ? 0
> > : font->space_width);
> >
> > However, that didn't fix the problem.
>
> You meant
>
> fprintf (stderr, "(%d)", font == NULL ? 0 :
> font->space_width);
>
> It's font that could be null, not its space_width.
>
> Davis
>
> PS - This says nothing about why font is null -- it might be a bug, or
> it might just be a bug that this code uses it without checking.
>
> --
> This product is sold by volume, not by mass. If it appears too dense or
> too sparse, it is because mass-energy conversion has occurred during
> shipping.