sdl: sdl.go: Add errorFromInt() helper function
@@ -142,3 +142,11 @@ func WasInit(flags uint32) uint32 {
func GetPlatform() string {
return string(C.GoString(C.SDL_GetPlatform()))
}
+
+// errorFromInt returns GetError() if passed negative value, otherwise it returns nil.
+func errorFromInt(code int) error {
+ if code < 0 {
+ return GetError()
+ }
+ return nil
+}
