Skip to content

Commit 262e4d4

Browse files
authored
Merge pull request #3645 from Goober5000/shipname_fix
correct shipname return type
2 parents e742bd1 + c9d71ce commit 262e4d4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

code/parse/sexp/LuaSEXP.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,9 @@ luacpp::LuaValue LuaSEXP::sexpToLua(int node, int argnum) const {
174174
auto ship_entry = eval_ship(node);
175175

176176
// if this is a shipname type, we want the name of a valid ship but not the ship itself
177-
if (ship_entry && argtype.first == "shipname") {
178-
return LuaValue::createValue(_action.getLuaState(), ship_entry->name);
177+
// (if the ship is not valid, return an empty string)
178+
if (argtype.first == "shipname") {
179+
return LuaValue::createValue(_action.getLuaState(), ship_entry ? ship_entry->name : "");
179180
}
180181

181182
if (!ship_entry || ship_entry->status != ShipStatus::PRESENT) {

0 commit comments

Comments
 (0)