mirror of
https://github.com/go-gst/go-gst.git
synced 2025-09-26 20:11:18 +08:00
nil safety for unsafe structure instances
This commit is contained in:
@@ -94,7 +94,13 @@ func (s *Structure) UnmarshalInto(data interface{}) error {
|
||||
}
|
||||
|
||||
// Instance returns the native GstStructure instance.
|
||||
func (s *Structure) Instance() *C.GstStructure { return C.toGstStructure(s.ptr) }
|
||||
func (s *Structure) Instance() *C.GstStructure {
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return C.toGstStructure(s.ptr)
|
||||
}
|
||||
|
||||
// Free frees the memory for the underlying GstStructure.
|
||||
func (s *Structure) Free() { C.gst_structure_free(s.Instance()) }
|
||||
|
Reference in New Issue
Block a user