Skip to content
  • Johan Ouwerkerk's avatar
    Fix segfault when attempting to generate or enter in an invalid game variant. · 817ad710
    Johan Ouwerkerk authored
    Summary:
    This change resolves T5981.
    The segfault is fixed by checking whether or not a Game object is valid, before letting the user play with it.
    
    Test Plan:
    Manually added a borked game variant in KSudoku::updateShapesList() using a CustomGameVariant with null QUrl.
    Compiled and verified the segfault no longer occurred.
    
    ```
    /*
     * For the purpose of testing the change, a deliberately borked game variant.
     * TODO: remove in final version of diff.
     */
    variant = new CustomGame(i18n("Invalid TODO Remove me"), QUrl(), m_gameVariants);
    variant->setDescription(i18n("Invalid TODO Remove me"));
    variant->setIcon("ksudoku-ksudoku_9x9");
    ```
    
    Reviewers: #kde_games, ltoscano
    
    Reviewed By: ltoscano
    
    Subscribers: ltoscano, #kde_games
    
    Maniphest Tasks: T5981
    
    Differential Revision: https://phabricator.kde.org/D5671
    817ad710