Skip to content

BaseMTPCamera GetObjects Exception : Index was out of range. #411

@sahaine

Description

@sahaine

I encountered an error today relating to retrieving images from a Nikon D5:

It related to CameraControl.Devices\BaseMTPCamera and the method:

public override AsyncObservableCollection GetObjects(object storageId, bool loadThumbs)

When checking the response data the array can ben empty but not null, I believe we should check the array length to ensure there is data before trying to covert it. the call:

int objCount = BitConverter.ToInt32(response.Data, 0); Threw the exception : Index was out of range.

I thinks this could be addressed with an additional check after the null check:

        if (response.Data.Length == 0)
        {
            Log.Debug("Empty response data from read.");
            return res;
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions