[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check for null pointer

From: Carl Sorensen
Subject: Re: Check for null pointer
Date: Wed, 17 Aug 2011 05:56:04 -0600

On 8/16/11 11:15 PM, "Dan Eble" <address@hidden> wrote:

> I think the following code should check that ev is not null before
> dereferencing it.  This might be a factor in a segfault I saw.  (Sorry to be
> so vague, but I am not going to build lilypond to test the theory.  It would
> take a credible threat of violence to change my mind.)  A grep suggests that
> there may be other similar cases.
> void
> Dispatcher::dispatch (SCM sev)
> {
>   Stream_event *ev = unsmob_stream_event (sev);
>   SCM class_symbol = ev->get_property ("class");

Certainly there would be a segfault if sev is null.  And perhaps this is the
best place to check for it.  But this would not be the best place to place a
warning and handle the null sev, because there is no context for how the
null sev got in the call.

Do you have more information about the segfault that you'd be willing to
share with us?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]