Fix NULL string checking

This commit is contained in:
smallmodel 2025-01-15 18:03:37 +01:00
parent 619d27da81
commit 3f9bed938e
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -5735,7 +5735,7 @@ void ScriptThread::FileExists(Event *ev)
filename = ev->GetString(1);
if (filename == NULL) {
if (!filename.length()) {
throw ScriptException("Empty file name passed to fexists!\n");
}
@ -5814,7 +5814,7 @@ void ScriptThread::FileSaveAll(Event *ev)
text = ev->GetString(2);
if (text == NULL) {
if (text.length()) {
ev->AddInteger(-1);
throw ScriptException("Text to be written is NULL - fsaveall!\n");
}
@ -5838,7 +5838,7 @@ void ScriptThread::FileRemove(Event *ev)
filename = ev->GetString(1);
if (filename == NULL) {
if (!filename.length()) {
throw ScriptException("Empty file name passed to fremove!\n");
}
@ -5948,7 +5948,7 @@ void ScriptThread::FileReadPak(Event *ev)
filename = ev->GetString(1);
if (filename == NULL) {
if (!filename.length()) {
throw ScriptException("Filename is NULL - freadpak!\n");
}
@ -6023,7 +6023,7 @@ void ScriptThread::FileNewDirectory(Event *ev)
path = ev->GetString(1);
if (path == NULL) {
if (!path.length()) {
throw ScriptException("Path is NULL - fnewdir!\n");
}
@ -6051,7 +6051,7 @@ void ScriptThread::FileRemoveDirectory(Event *ev)
path = ev->GetString(1);
if (path == NULL) {
if (!path.length()) {
throw ScriptException("Path is NULL - fremovedir!\n");
}