Check for empty context was added
This commit is contained in:
@@ -25,6 +25,11 @@ LibUsbDevice::~LibUsbDevice()
|
|||||||
|
|
||||||
void LibUsbDevice::openDevice(uint16_t vendorId, uint16_t productId)
|
void LibUsbDevice::openDevice(uint16_t vendorId, uint16_t productId)
|
||||||
{
|
{
|
||||||
|
if (!m_context) {
|
||||||
|
std::cerr << "Context not initialized! Unable to open device";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_device = libusb_open_device_with_vid_pid(m_context, vendorId, productId);
|
m_device = libusb_open_device_with_vid_pid(m_context, vendorId, productId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user