MCPcopy
hub / github.com/wavetermdev/waveterm / SafeDeref

Function SafeDeref

pkg/util/utilfn/utilfn.go:955–961  ·  view source on GitHub ↗

** * Helper function that will deref a pointer if not null * but returns a default value if it is null. */

(x *T)

Source from the content-addressed store, hash-verified

953 * but returns a default value if it is null.
954 */
955func SafeDeref[T any](x *T) T {
956 if x == nil {
957 var safeOut T
958 return safeOut
959 }
960 return *x
961}
962
963/**
964 * Utility function for referencing a type with a pointer.

Callers 3

createPublicKeyCallbackFunction · 0.92
createClientConfigFunction · 0.92
ConnectToClientFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected