Skip to content
Snippets Groups Projects
  • Sven M. Hallberg's avatar
    check resolve() for NULL return · 9353a85c
    Sven M. Hallberg authored
    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.
    9353a85c
    History