Skip to content

Commit 8c754f4

Browse files
committed
sdl: sdl.go: Add errorFromInt() helper function
Signed-off-by: Lilis Iskandar <[email protected]>
1 parent bcacb13 commit 8c754f4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sdl/sdl.go

+8
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,11 @@ func WasInit(flags uint32) uint32 {
142142
func GetPlatform() string {
143143
return string(C.GoString(C.SDL_GetPlatform()))
144144
}
145+
146+
// errorFromInt returns GetError() if passed negative value, otherwise it returns nil.
147+
func errorFromInt(code int) error {
148+
if code < 0 {
149+
return GetError()
150+
}
151+
return nil
152+
}

0 commit comments

Comments
 (0)