Skip to content

Commit 28851a1

Browse files
committed
check nils
1 parent 28532f5 commit 28851a1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

telemetry.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,26 @@ func New() *AccTelemetry {
6969

7070
// this returns direct pointer to the memory so underlying struct will change over time
7171
func (t *AccTelemetry) GraphicsPointer() *AccGraphic {
72-
return t.graphicsData.data
72+
if t.graphicsData != nil {
73+
return t.graphicsData.data
74+
}
75+
return nil
7376
}
7477

7578
// this returns direct pointer to the memory so underlying struct will change over time
7679
func (t *AccTelemetry) StaticPointer() *AccStatic {
77-
return t.staticData.data
80+
if t.staticData != nil {
81+
return t.staticData.data
82+
}
83+
return nil
7884
}
7985

8086
// this returns direct pointer to the memory so underlying struct will change over time
8187
func (t *AccTelemetry) PhysicsPointer() *AccPhysics {
82-
return t.physicsData.data
88+
if t.physicsData != nil {
89+
return t.physicsData.data
90+
}
91+
return nil
8392
}
8493

8594
func (t *AccTelemetry) Close() error {

0 commit comments

Comments
 (0)