Skip to content

Commit

Permalink
Merge pull request #57 from jazzychad/jc-negative-integer-crash-fix
Browse files Browse the repository at this point in the history
Fix crash for negative uvcUnit integers (Issue #42)
  • Loading branch information
Itaybre authored Apr 29, 2022
2 parents afd68a5 + edb2d4f commit 021ec45
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CameraController/UVC/Models/Controls/UVCControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class UVCControl {
}

func getDataFor(type: UVCRequestCodes, length: Int) -> Int {

guard uvcUnit >= 0 else { return 0 }

var value: Int = 0

let requestType = USBmakebmRequestType(direction: kUSBIn, type: kUSBClass, recipient: kUSBInterface)
Expand Down Expand Up @@ -60,6 +63,9 @@ class UVCControl {
}

func setData(value: Int, length: Int) -> Bool {

guard uvcUnit >= 0 else { return false }

var ref = value

let requestType = USBmakebmRequestType(direction: kUSBOut, type: kUSBClass, recipient: kUSBInterface)
Expand Down

0 comments on commit 021ec45

Please sign in to comment.