Menu

#27 Button doesn't cope with NULL font

closed-accepted
nobody
None
5
2007-12-08
2007-12-07
Anonymous
No

Although you can supposedly pass NULL for the font pointer, and rely on the system populating it (at addGadget() time), the constructor for Button expects it to be valid, because it calls Button::calculateTextPosition()

It should at least protect against dereferencing the null pointer - in fact, I'm not sure why it didn't crash completely (though I only tried it in DesMume)

Discussion

  • Ant

    Ant - 2007-12-08

    Logged In: YES
    user_id=1910533
    Originator: NO

    DeSMuMe is a swine when trying to debug - it almost never falls over when it hits a null pointer. No$GBA and real hardware will crash, though.

     
  • Ant

    Ant - 2007-12-08

    Logged In: YES
    user_id=1910533
    Originator: NO

    Fixed. I've implemented the static system font in Woopsi, and all gadgets now use that if no font is passed n. All font parameters in gadget constructors are now optional. I've had to remove the inheritance idea as it proved unworkable without a little extra work, which really seems superfluous considering the ease with which a new gadget can be added using the parent gadget's font.

     
  • Ant

    Ant - 2007-12-08
    • status: open --> closed-accepted
     

Log in to post a comment.