craftcms / feed-me

Craft CMS plugin for importing entry data from XML, RSS or ATOM feeds—routine task or on-demand.
Other
289 stars 139 forks source link

Impossible to access a key ("0") on a null variable #306

Closed colinmeinke closed 6 years ago

colinmeinke commented 6 years ago

Description

I'm getting this error when I try to import JSON or CSV as a channel entries.

Twig Runtime Error – Twig_Error_Runtime
Impossible to access a key ("0") on a null variable.

1. in /path/to/vendor/verbb/feed-me/src/templates/_includes/fields/entries.html at line 83
7475767778798081828384858687

{% endfor %}

    <div class="element-group element-group-entrytype" data-items="{{ entryTypes | json_encode }}">
        <span>{{ 'Type:' | t('feed-me') }}</span>
            {{ forms.selectField({
                name: 'options[group][typeId]',
                class: '',
                value: feed.fieldMapping[handle].options.group.typeId ?? '',
                options: entryTypes['item_' ~ sources[0].id] ?? [],
            }) }}
            {{ forms.selectField({
                name: 'options[group][typeId]',
                class: '',
                value: feed.fieldMapping[handle].options.group.typeId ?? '',
                options: entryTypes['item_' ~ sources[0].id] ?? [],
            }) }}
        </div>
    </div>
{% endblock %}

Steps to reproduce

  1. Setup a new feed
  2. Source https://file-bnstmyhhhg.now.sh (JSON, although I have the same issue with the equivalent CSV)
  3. Select items as root element
  4. Error is thrown

Additional info

engram-design commented 6 years ago

I’ve fixed this up in 3.0.0-beta.7