Previous 15994 Revisions Next

r5805 Saturday 19th September, 2009 at 20:57:04 UTC by Miodrag Milanović
Fixed crash when creating image if there is creation is not supported.
[src/mess]image.c

src/mess/image.c
r5804r5805
173173
174174void image_init(running_machine *machine)
175175{
176    int count, indx, format_count, i;
176    int count, indx, format_count, i,cnt;
177177    const device_config *dev;
178178    size_t private_size;
179179    image_slot_data *slot;
r5804r5805
226226        /* creation formats */
227227        format_count = device_get_info_int(slot->dev, DEVINFO_INT_IMAGE_CREATE_OPTCOUNT);
228228        formatptr = &slot->formatlist;
229        cnt = 0;
229230        for (i = 0; i < format_count; i++)
230231        {
231            /* allocate a new format */
232            format = auto_alloc_clear(machine, image_device_format);
233
234            /* populate it */
235            format->index       = i;
236            format->name        = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTNAME + i));
237            format->description = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTDESC + i));
238            format->extensions  = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i));
239            format->optspec     = device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
240
241            /* and append it to the list */
242            *formatptr = format;
243            formatptr = &format->next;
232           // only add if creatable
233           if (device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i)) {
234               /* allocate a new format */
235               format = auto_alloc_clear(machine, image_device_format);
236   
237               /* populate it */
238               format->index       = cnt;
239               format->name        = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTNAME + i));
240               format->description = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTDESC + i));
241               format->extensions  = auto_strdup(machine, device_get_info_string(slot->dev, DEVINFO_STR_IMAGE_CREATE_OPTEXTS + i));
242               format->optspec     = device_get_info_ptr(slot->dev, DEVINFO_PTR_IMAGE_CREATE_OPTSPEC + i);
243   
244               /* and append it to the list */
245               *formatptr = format;
246               formatptr = &format->next;
247               cnt++;
248           }
244249        }
245250
246251        indx++;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team