title: System.NullPointerException: Attempt to de-reference a null object but value is not null
body: <p>I have a trigger that is creating a set of ID's for a custom object, Base Elements. I'm getting the System.NullPointerException: Attempt to de-reference a null object on the line, bepc.add(b.BMCServiceDesk__PrimaryClient__c); But I am debugging it the line before so I know that it's not null. Any idea what is going on?</p>
  
  <p>This is not a test class in case anyone was wondering.</p>
  
  <pre><code>Set&lt;ID&gt; bepc; 
  FOR (BMCServiceDesk__BMC_BaseElement__c b : [SELECT BMCServiceDesk__PrimaryClient__c FROM BMCServiceDesk__BMC_BaseElement__c WHERE BMCServiceDesk__PrimaryClient__c!=null ]) {
      system.debug('pc: '+b.BMCServiceDesk__PrimaryClient__c);
      bepc.add(b.BMCServiceDesk__PrimaryClient__c);
  }
  </code></pre>