Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sahaine opened this issue Nov 19, 2023 · 0 comments
Open

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

sahaine opened this issue Nov 19, 2023 · 0 comments

Comments

@sahaine
Copy link

sahaine commented Nov 19, 2023

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;
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant