D5671: Fix segfault when attempting to generate or enter in an invalid game variant.

Johan Ouwerkerk noreply at phabricator.kde.org
Sun Apr 30 22:16:20 UTC 2017


ouwerkerk created this revision.
Restricted Application added a reviewer: KDE Games.
Restricted Application added a subscriber: KDE Games.

REVISION SUMMARY
  This change resolves https://phabricator.kde.org/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");

REPOSITORY
  R417 KSudoku

BRANCH
  t5981-invalid-game-variant-segfault

REVISION DETAIL
  https://phabricator.kde.org/D5671

AFFECTED FILES
  src/gui/welcomescreen.cpp

To: ouwerkerk, #kde_games
Cc: #kde_games
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20170430/f9e7d670/attachment-0001.html>


More information about the kde-games-devel mailing list