@@ -267,7 +267,10 @@ static usb_error_t get_configuration_descriptor_handler(usb_endpoint_t endpoint,
267
267
usb_device_t device = usb_GetEndpointDevice (endpoint );
268
268
struct item * item = usb_GetDeviceData (device );
269
269
const usb_configuration_descriptor_t * configuration_descriptor = data ;
270
- item -> gui -> dirty = true;
270
+ if (item && item -> gui )
271
+ {
272
+ item -> gui -> dirty = true;
273
+ }
271
274
if (item == NULL || configuration_descriptor == NULL || status != USB_TRANSFER_COMPLETED ||
272
275
transferred != item -> configuration_descriptor .wTotalLength ||
273
276
configuration_descriptor -> bLength < sizeof (usb_configuration_descriptor_t ) ||
@@ -292,14 +295,20 @@ static usb_error_t get_total_length_handler(usb_endpoint_t endpoint, usb_transfe
292
295
item -> configuration_descriptor .bLength < transferred ||
293
296
item -> configuration_descriptor .bDescriptorType != USB_CONFIGURATION_DESCRIPTOR )
294
297
{
295
- item -> gui -> dirty = true;
298
+ if (item && item -> gui )
299
+ {
300
+ item -> gui -> dirty = true;
301
+ }
296
302
return USB_SUCCESS ;
297
303
}
298
304
299
305
configuration_descriptor = malloc (item -> configuration_descriptor .wTotalLength );
300
306
if (configuration_descriptor == NULL )
301
307
{
302
- item -> gui -> dirty = true;
308
+ if (item && item -> gui )
309
+ {
310
+ item -> gui -> dirty = true;
311
+ }
303
312
return USB_SUCCESS ;
304
313
}
305
314
item -> setup .bmRequestType = USB_DEVICE_TO_HOST | USB_STANDARD_REQUEST | USB_RECIPIENT_DEVICE ;
@@ -321,7 +330,10 @@ static usb_error_t get_serial_number_handler(usb_endpoint_t endpoint, usb_transf
321
330
item -> string_descriptor .bLength < 2 || item -> string_descriptor .bLength > transferred ||
322
331
item -> string_descriptor .bDescriptorType != USB_STRING_DESCRIPTOR )
323
332
{
324
- item -> gui -> dirty = true;
333
+ if (item && item -> gui )
334
+ {
335
+ item -> gui -> dirty = true;
336
+ }
325
337
return USB_SUCCESS ;
326
338
}
327
339
usb_string_descriptor_to_ascii (& item -> string_descriptor , item -> serial_number );
@@ -345,7 +357,10 @@ static usb_error_t get_product_handler(usb_endpoint_t endpoint, usb_transfer_sta
345
357
item -> string_descriptor .bLength < 2 || item -> string_descriptor .bLength > transferred ||
346
358
item -> string_descriptor .bDescriptorType != USB_STRING_DESCRIPTOR )
347
359
{
348
- item -> gui -> dirty = true;
360
+ if (item && item -> gui )
361
+ {
362
+ item -> gui -> dirty = true;
363
+ }
349
364
return USB_SUCCESS ;
350
365
}
351
366
usb_string_descriptor_to_ascii (& item -> string_descriptor , item -> product );
@@ -376,7 +391,10 @@ static usb_error_t get_manufacturer_handler(usb_endpoint_t endpoint, usb_transfe
376
391
item -> string_descriptor .bLength < 2 || item -> string_descriptor .bLength > transferred ||
377
392
item -> string_descriptor .bDescriptorType != USB_STRING_DESCRIPTOR )
378
393
{
379
- item -> gui -> dirty = true;
394
+ if (item && item -> gui )
395
+ {
396
+ item -> gui -> dirty = true;
397
+ }
380
398
return USB_SUCCESS ;
381
399
}
382
400
usb_string_descriptor_to_ascii (& item -> string_descriptor , item -> manufacturer );
@@ -415,7 +433,10 @@ static usb_error_t get_langid_handler(usb_endpoint_t endpoint, usb_transfer_stat
415
433
item -> string_descriptor .bLength < transferred ||
416
434
item -> string_descriptor .bDescriptorType != USB_STRING_DESCRIPTOR )
417
435
{
418
- item -> gui -> dirty = true;
436
+ if (item && item -> gui )
437
+ {
438
+ item -> gui -> dirty = true;
439
+ }
419
440
return USB_SUCCESS ;
420
441
}
421
442
item -> langid = item -> string_descriptor .bString [0 ];
@@ -446,7 +467,10 @@ static usb_error_t get_device_descriptor_handler(usb_endpoint_t endpoint, usb_tr
446
467
item -> device_descriptor .bLength < transferred ||
447
468
item -> device_descriptor .bDescriptorType != USB_DEVICE_DESCRIPTOR )
448
469
{
449
- item -> gui -> dirty = true;
470
+ if (item && item -> gui )
471
+ {
472
+ item -> gui -> dirty = true;
473
+ }
450
474
return USB_SUCCESS ;
451
475
}
452
476
@@ -464,7 +488,6 @@ static usb_error_t enabled_handler(usb_device_t device)
464
488
struct item * item = usb_GetDeviceData (device );
465
489
if (item == NULL )
466
490
{
467
- item -> gui -> dirty = true;
468
491
return USB_SUCCESS ;
469
492
}
470
493
item -> setup .bmRequestType = USB_DEVICE_TO_HOST | USB_STANDARD_REQUEST | USB_RECIPIENT_DEVICE ;
0 commit comments