Apologies for the delay on this. Since you responded back so quickly on this thread, it appeared that it had already been responded to.
With the limited information you have provided, it is difficult for us to determine why you are receiving NULL. We are assuming you are creating your own extension. If so, we would need to see more of your code to better understand your intent.
If you have already resolved your issue, please feel free to post the solution here for the benefit of others who may have similar questions.