Answers.Body: <p>That message is telling you that <code>gatewayHandle</code> can't be accessed from <code>video</code>, because <code>video</code> is <code>NULL</code>. You're expecting the videos field to always contain an object, but in this case it is not.</p>
  
  <p>I would suggest that you ensure that <code>video</code> actually contains a value before you attempt to reference one of its properties...</p>
  
  <pre><code>{% set video = entries.video %}
  
  {% if video %}
  
      {% if video.gatewayHandle == 'youtube' %}
          ...
      {% endif %}
  
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-03T22:24:58.397Z
Answers.Text: wouldn't it be: `{% set video = entries.video.first %}`?
Answers.UserDisplayName: Marion Newlevant
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-03T23:41:02.557Z
Answers.Text: Could be, that's probably why it's returning `NULL`. I didn't think much about his data structure, just simply telling him what that error meant, and how to protect against it.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-02-02T22:40:53.580Z
Answers.LastActivityDate: 2015-02-02T22:40:53.580Z
Answers.UserDisplayName: Lindsey D
Body: <p>I am getting this error returned whilst in Debug mode:</p>
  
  <blockquote>
    <p>Template Error</p>
    
    <p>Impossible to access an attribute ("gatewayHandle") on a NULL variable ("")</p>
  </blockquote>
  
  <p>Not sure why this is getting flagged up. It is a variable which is accessed through the Dukt Video plugin? Seems to work when not in debug mode, but I am getting slow initial response times when loading, not sure if this is related to that issue.</p>
  
  <p>I have attached the relevant page code:</p>
  
  <pre><code>{# Video Link :: if entry is of video type #}
  
  {% if entries.section == "Videos" %}
  
      {% set video = entries.video %}
  
      {% if video.gatewayHandle == 'youtube' %}
          &lt;a
              data-target="flare"
              href="http://youtu.be/{{ video.id }}"
          &gt;
      {% else %}
          &lt;a
              data-target="flare"
              href="http://vimeo.com/{{ video.id }}"
          &gt;
      {% endif %}
  
  {% else %}
  
  {# Entry link #}
  
  &lt;a href="{{ entries.url }}"&gt;
  </code></pre>
  
  <p>Any help would be appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-02T22:28:30.773Z
Comments.Text: Hi Daryl, looks like you accidentally posted this in the "Meta" section... I'll go ahead and move it back to the main Stack Exchange site for you.
Comments.UserDisplayName: Lindsey D
Tags: <templating><plugin-duktvideos>
Title: "Impossible to access an attribute on a NULL variable"
ThreadText: # "Impossible to access an attribute on a NULL variable"
  
  (Asked by: username_0 on 2015-02-02)
  
  I am getting this error returned whilst in Debug mode:
  
  > Template Error
  >
  > Impossible to access an attribute ("gatewayHandle") on a NULL variable ("")
  
  Not sure why this is getting flagged up. It is a variable which is accessed through the Dukt Video plugin? Seems to work when not in debug mode, but I am getting slow initial response times when loading, not sure if this is related to that issue.
  
  I have attached the relevant page code:
  
  ```
  {# Video Link :: if entry is of video type #}
  
  {% if entries.section == "Videos" %}
  
      {% set video = entries.video %}
  
      {% if video.gatewayHandle == 'youtube' %}
          <a
              data-target="flare"
              href="http://youtu.be/{{ video.id }}"
          >
      {% else %}
          <a
              data-target="flare"
              href="http://vimeo.com/{{ video.id }}"
          >
      {% endif %}
  
  {% else %}
  
  {# Entry link #}
  
  <a href="{{ entries.url }}">
  
  ```
  
  Any help would be appreciated.
  
  **Tags:** templating, plugin-duktvideos
  
  > **Comments:**
  > **username_1**: Hi username_0, looks like you accidentally posted this in the "Meta" section... I'll go ahead and move it back to the main Stack Exchange site for you.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-02-02. Score: 2
  
  That message is telling you that `gatewayHandle` can't be accessed from `video`, because `video` is `NULL`. You're expecting the videos field to always contain an object, but in this case it is not.
  
  I would suggest that you ensure that `video` actually contains a value before you attempt to reference one of its properties...
  
  ```
  {% set video = entries.video %}
  
  {% if video %}
  
      {% if video.gatewayHandle == 'youtube' %}
          ...
      {% endif %}
  
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_2**: wouldn't it be: `{% set video = entries.video.first %}`?  
  > **username_1**: Could be, that's probably why it's returning `NULL`. I didn't think much about his data structure, just simply telling him what that error meant, and how to protect against it.  
  
  ---
  
  