$OpenBSD: patch-src_main_c,v 1.2 2011/03/02 06:31:35 jasper Exp $

From Bug 672 in OpenMoko via Simon Moore

--- src/main.c.orig	Wed Feb 16 15:36:44 2011
+++ src/main.c	Wed Feb 16 15:36:47 2011
@@ -103,8 +103,8 @@ static int find_dfu_if(struct usb_device *dev, int (*h
 
 	memset(dfu_if, 0, sizeof(*dfu_if));
 
-	for (cfg_idx = 0; cfg_idx < dev->descriptor.bNumConfigurations;
-	     cfg_idx++) {
+	for (cfg_idx = 0; NULL != dev->config &&
+		cfg_idx < dev->descriptor.bNumConfigurations; cfg_idx++) {
 		cfg = &dev->config[cfg_idx];
 		/* in some cases, noticably FreeBSD if uid != 0,
 		 * the configuration descriptors are empty */
