Skip to content
This repository was archived by the owner on Dec 7, 2020. It is now read-only.
This repository was archived by the owner on Dec 7, 2020. It is now read-only.

undefined method `each' for nil:NilClass when iterating over empty response #6

@aleccarper

Description

@aleccarper

Hello,

I've recently encountered an error that occurs while trying to iterate over orders, or simply checking the count of orders, when no orders are returned. I have tracked this down to line 39-41 of paged_ecwid_response.rb:

    response.body["items"].each do |item|
      yielder << block.call(item)
    end

If this block is moved below where count, offset, and total are set and then wrapped in an if count > 0 both iteration and count checks work as expected.

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