Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add guard in lua against nil group from dead unit #232

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/DCS-gRPC/exporters/object.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ GRPC.exporters.rawTransform = function(object)
end

GRPC.exporters.group = function(group)
if type(group) ~= "table" and getmetatable(group) ~= Group then return nil end
return {
id = tonumber(group:getID()),
name = group:getName(),
Expand Down
4 changes: 2 additions & 2 deletions protos/dcs/common/v0/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ message Unit {
Velocity velocity = 8;
// The name of the player if one is in control of the unit
optional string player_name = 9;
// The group that the unit belongs to
Group group = 10;
// The group that the unit belongs to (dead units have no group)
optional Group group = 10;
// The number of this unit in the group. Does not change as units are
// destroyed
uint32 number_in_group = 11;
Expand Down