title: Sitecore's "Links" button doesn't work because of a null-reference exception
body: <p>I am trying to see a certain item's linked items. I am doing this on a client's content management server. When I click on Navigate -> Links, nothing happens. I get this error in the JavaScript console:</p>
  
  <blockquote>
    <p><a href="http://sitename.local/sitecore/shell/default.aspx?xmlcontrol=Gallery.Links&amp;" rel="nofollow">http://sitename.local/sitecore/shell/default.aspx?xmlcontrol=Gallery.Links&amp;</a>…de-DE&amp;vs=1&amp;db=master&amp;sc_content=master&amp;ShowEditor=1&amp;Ribbon.RenderTabs=true</p>
    
    <p>Failed to load resource: the server responded with a status of 500 (Internal Server Error)</p>
  </blockquote>
  
  <p>Here's what I see in Sitecore logs:</p>
  
  <pre><code>38424 19:09:30 ERROR Application error.
  Exception: System.Web.HttpUnhandledException
  Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
  Source: System.Web
     at System.Web.UI.Page.HandleError(Exception e)
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
     at System.Web.UI.Page.ProcessRequest()
     at System.Web.UI.Page.ProcessRequest(HttpContext context)
     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)
  
  Nested Exception
  
  Exception: System.Reflection.TargetInvocationException
  Message: Exception has been thrown by the target of an invocation.
  Source: mscorlib
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
     at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
     at Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e)
     at System.Web.UI.Control.LoadRecursive()
     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  
  Nested Exception
  
  Exception: System.ArgumentNullException
  Message: Value cannot be null.
  Parameter name: ownerItem
  Source: Sitecore.Kernel
     at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
     at Sitecore.Data.Fields.Field..ctor(ID fieldID, Item ownerItem)
     at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.GetLinkTooltip(Item reference, ItemLink link)
     at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.RenderReferences(StringBuilder result, List`1 references)
     at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.OnLoad(EventArgs e)
  </code></pre>
  
  <p>It looks like the <code>ownerItem</code> argument is null when creating an item field.</p>
  
  <p>This happens for several different items—e.g. templates and sublayouts.</p>
  
  <p>What is causing this issue and how do I fix it?</p>