summaryrefslogtreecommitdiffhomepage
path: root/games/transmission
diff options
context:
space:
mode:
authornoshbar <[email protected]>2018-10-10 22:05:13 +0200
committernoshbar <[email protected]>2018-10-10 22:05:13 +0200
commit1d548eaa4b796f0416247f69074dfeec0264dd71 (patch)
tree4f000fe67d64d2da8eeed197b1ff398c3a2f4524 /games/transmission
parentf238b9ea3c6b2b380a07d37ebe82d7fcde4a1ce1 (diff)
downloadraylib-1d548eaa4b796f0416247f69074dfeec0264dd71.tar.gz
raylib-1d548eaa4b796f0416247f69074dfeec0264dd71.zip
3 minor sample game cleanups:
* changed bitwise & to logical && * removed redundant state check * moved a strcpy inside a NULL check to prevent a crash. NOTE: nothing sensible will happen as a result, but no crash at least.
Diffstat (limited to 'games/transmission')
-rw-r--r--games/transmission/screens/screen_ending.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/games/transmission/screens/screen_ending.c b/games/transmission/screens/screen_ending.c
index 0aba5f01..d0cf7d89 100644
--- a/games/transmission/screens/screen_ending.c
+++ b/games/transmission/screens/screen_ending.c
@@ -110,10 +110,12 @@ void InitEndingScreen(void)
{
// WARNING: It fails if the last sentence word has a '.' after space
char *title = StringReplace(headline, messageWords[i].text, codingWords[messageWords[i].id]);
-
- strcpy(headline, title); // Base headline updated
-
- if (title != NULL) free(title);
+
+ if (title != NULL)
+ {
+ strcpy(headline, title); // Base headline updated
+ free(title);
+ }
}
}