summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2009-05-19 17:04:42 +0000
committerglx <glx@openttd.org>2009-05-19 17:04:42 +0000
commitec76117379c31454cc0724f05a97ce33c4f88f88 (patch)
treeeb4ba68272ed446bdd16b99b11dea24e8ff408c7 /src
parent1e45f4bc4c1faf89469ef9b92ae7b5ce358dda46 (diff)
downloadopenttd-ec76117379c31454cc0724f05a97ce33c4f88f88.tar.xz
(svn r16358) -Fix (r16343): strdup doesn't like NULL
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 5f0ec19f9..022a01e31 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -576,7 +576,7 @@ int ttd_main(int argc, char *argv[])
/* This must be done early, since functions use the InvalidateWindow* calls */
InitWindowSystem();
- if (graphics_set == NULL) graphics_set = strdup(_ini_graphics_set);
+ if (graphics_set == NULL && _ini_graphics_set != NULL) graphics_set = strdup(_ini_graphics_set);
if (!SetGraphicsSet(graphics_set)) {
StrEmpty(graphics_set) ?
usererror("Failed to find a graphics set. Please acquire a graphics set for OpenTTD.") :
@@ -588,7 +588,7 @@ int ttd_main(int argc, char *argv[])
GfxInitPalettes();
DEBUG(misc, 1, "Loading blitter...");
- if (blitter == NULL) blitter = strdup(_ini_blitter);
+ if (blitter == NULL && _ini_blitter != NULL) blitter = strdup(_ini_blitter);
if (BlitterFactoryBase::SelectBlitter(blitter) == NULL)
StrEmpty(blitter) ?
usererror("Failed to autoprobe blitter") :
@@ -597,7 +597,7 @@ int ttd_main(int argc, char *argv[])
DEBUG(driver, 1, "Loading drivers...");
- if (sounddriver == NULL) sounddriver = strdup(_ini_sounddriver);
+ if (sounddriver == NULL && _ini_sounddriver != NULL) sounddriver = strdup(_ini_sounddriver);
_sound_driver = (SoundDriver*)SoundDriverFactoryBase::SelectDriver(sounddriver, Driver::DT_SOUND);
if (_sound_driver == NULL) {
StrEmpty(sounddriver) ?
@@ -606,7 +606,7 @@ int ttd_main(int argc, char *argv[])
}
free(sounddriver);
- if (musicdriver == NULL) musicdriver = strdup(_ini_musicdriver);
+ if (musicdriver == NULL && _ini_musicdriver != NULL) musicdriver = strdup(_ini_musicdriver);
_music_driver = (MusicDriver*)MusicDriverFactoryBase::SelectDriver(musicdriver, Driver::DT_MUSIC);
if (_music_driver == NULL) {
StrEmpty(musicdriver) ?
@@ -615,7 +615,7 @@ int ttd_main(int argc, char *argv[])
}
free(musicdriver);
- if (videodriver == NULL) videodriver = strdup(_ini_videodriver);
+ if (videodriver == NULL && _ini_videodriver != NULL) videodriver = strdup(_ini_videodriver);
_video_driver = (VideoDriver*)VideoDriverFactoryBase::SelectDriver(videodriver, Driver::DT_VIDEO);
if (_video_driver == NULL) {
StrEmpty(videodriver) ?