mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-10 21:55:11 +01:00
author/filename/name should always be set to something
This commit is contained in:
parent
89ba23647c
commit
d884351ba8
@ -27,9 +27,9 @@ GameInfo::GameInfo(const char *filename,
|
|||||||
const char *name, const char *author,
|
const char *name, const char *author,
|
||||||
SDL_Surface *image)
|
SDL_Surface *image)
|
||||||
{
|
{
|
||||||
this->filename = filename;
|
this->filename = xstrdup(filename);
|
||||||
this->name = name;
|
this->name = xstrdup(name);
|
||||||
this->author = author;
|
this->author = xstrdup(author);
|
||||||
this->screenshot = image;
|
this->screenshot = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,16 +37,13 @@ GameInfo::GameInfo(GameInfo *gi)
|
|||||||
{
|
{
|
||||||
if (!gi)
|
if (!gi)
|
||||||
{
|
{
|
||||||
this->filename = NULL;
|
this->resetDefaults();
|
||||||
this->name = NULL;
|
|
||||||
this->author = NULL;
|
|
||||||
this->screenshot = NULL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->name = gi->name ? xstrdup(gi->name) : NULL;
|
this->name = xstrdup(gi->name);
|
||||||
this->author = gi->author ? xstrdup(gi->author) : NULL;
|
this->author = xstrdup(gi->author);
|
||||||
this->filename = gi->filename ? xstrdup(gi->filename) : NULL;
|
this->filename = xstrdup(gi->filename);
|
||||||
this->screenshot = NULL;
|
this->screenshot = NULL;
|
||||||
|
|
||||||
if (gi->screenshot)
|
if (gi->screenshot)
|
||||||
@ -62,10 +59,11 @@ void GameInfo::resetDefaults()
|
|||||||
{
|
{
|
||||||
free((void*)this->name);
|
free((void*)this->name);
|
||||||
free((void*)this->author);
|
free((void*)this->author);
|
||||||
|
free((void*)this->filename);
|
||||||
SDL_FreeSurface(this->screenshot);
|
SDL_FreeSurface(this->screenshot);
|
||||||
|
|
||||||
this->name = NULL;
|
this->name = xstrdup(" ");
|
||||||
this->author = NULL;
|
this->author = xstrdup(" ");
|
||||||
this->screenshot = NULL;
|
this->screenshot = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ struct game_info
|
|||||||
class GameInfo
|
class GameInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GameInfo(const char *filename = NULL, const char *name = NULL,
|
GameInfo(const char *filename = " ", const char *name = " ",
|
||||||
const char *author = NULL,
|
const char *author = " ",
|
||||||
SDL_Surface *image = NULL);
|
SDL_Surface *image = NULL);
|
||||||
|
|
||||||
GameInfo(GameInfo *gi);
|
GameInfo(GameInfo *gi);
|
||||||
|
Loading…
Reference in New Issue
Block a user