Skip to content
Snippets Groups Projects
Commit 9353a85c authored by Sven M. Hallberg's avatar Sven M. Hallberg
Browse files

check resolve() for NULL return

Fix several erroneous uses of dictentry/resolve. In particular, it
is fine to call resolve() on NULL (it is a no-op in that case), but
its result must be tested. It returns NULL, for instance, if a
referenced object does not exist.

The correct idiom is therefore

    val = dictentry(dict, "key");
    val = resolve(aux, val);

or

    val = resolve(aux, dictentry(dict, "key"));

depending on taste. I have preferred the former (two-line) variant.

The idiom should be encapsulated in a function. There are also
several occurances of dictentry() in the code that are not followed
by resolve() but probably should be.

Fixes #31, #35.
parent 0f7d444f
Branches
Tags
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment