<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Null reference on clicking a marker]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=260&amp;type=atom" />
	<updated>2016-08-25T10:42:05Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=260</id>
		<entry>
			<title type="html"><![CDATA[Re: Null reference on clicking a marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1154#p1154" />
			<content type="html"><![CDATA[<p>yup...that fixed it. Thanks!</p>]]></content>
			<author>
				<name><![CDATA[gamar]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=162</uri>
			</author>
			<updated>2016-08-25T10:42:05Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1154#p1154</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Null reference on clicking a marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1153#p1153" />
			<content type="html"><![CDATA[<p>You have points == null.<br />This can happen in three cases:<br />1. You create a drawing element (line, poly) with points = null;<br />2. You set points = null;<br />3. You add drawing element, remove it, and add again.<br />By default, when you remove drawing element, it dispose.<br />To prevent this, use OnlineMaps.RemoveDrawingElement (element, <strong>false</strong>).</p><p>In the next update, when you try to use points = null (in all three cases), you&#039;ll get an exception immediately.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-08-24T20:50:54Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1153#p1153</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Null reference on clicking a marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1152#p1152" />
			<content type="html"><![CDATA[<p>Ok...this is weird...I haven&#039;t modified that method at all yet that is the error that I get.</p><p>I have taken another screenshot from another device and have a different stacktrace. I tracked it and the function exists this time(Horaay!)</p><p><span class="postimg"><img src="http://i.imgur.com/wwl27mW.png" alt="http://i.imgur.com/wwl27mW.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[gamar]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=162</uri>
			</author>
			<updated>2016-08-24T18:41:42Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1152#p1152</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Null reference on clicking a marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1151#p1151" />
			<content type="html"><![CDATA[<p>I just saw that you have a very strange stack trace.<br />In the original code HitTest is not used in InitLineMesh.<br />You have modified this method?</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-08-24T14:47:06Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1151#p1151</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Null reference on clicking a marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1150#p1150" />
			<content type="html"><![CDATA[<p>Sure. Each pin has an index attached. When I tap I just call ShowStory(pinIndex).</p><div class="codebox"><pre><code>private void ShowStory (int index)
        {
            if (index &lt; 0)
                return;

            m_onlineMaps.markers [m_currentArtifactIndex].zIndex = m_currentArtifactIndex;
            m_onlineMaps.markers [m_currentArtifactIndex].scale = m_artifactsActions [m_currentArtifactIndex].Scale;

            ActivityAction marker = m_artifactsActions [index];
            m_storiesCarousel.CenterOnChild (index, false);

            if (ComputeDirectionsFromUser (index)) {
                Vector2 center;
                int zoom;
                OnlineMapsUtils.GetCenterPointAndZoom (new Vector2[2] {
                    marker.Position.Value,
                    m_userPosition.Value
                }, out center, out zoom);
                m_onlineMaps.SetPositionAndZoom (center.x, center.y, zoom - 1);
            } else {
                m_onlineMaps.SetPosition (marker.Position.Value.x, marker.Position.Value.y);
            }

            if (m_currentArtifactIndex &gt;= 0)
                m_onlineMaps.markers [m_currentArtifactIndex].scale = m_artifactsActions [m_currentArtifactIndex].Scale;
            m_onlineMaps.markers [index].scale = marker.Scale * m_selectedPinSize;

            if (!m_isStoryShowing) {
                m_isStoryShowing = true;
                m_storiesContainer.GetComponent&lt;Animator&gt; ().SetTrigger (&quot;Show&quot;);
                ToolsController.Instance.OnlineMapsController.SlideLeft (true);
            }

            m_onlineMaps.markers [index].zIndex = -1;

            CheckGoToArtifactAvailability (index);

            m_currentArtifactIndex = index;
            m_onlineMaps.Redraw ();
        }

        private bool ComputeDirectionsFromUser (int artifactIndex)
        {
            ActivityAction marker = m_artifactsActions [artifactIndex];
            if (m_artifacts [artifactIndex].State != ArtifactState.Locked &amp;&amp; IsUserCloseTo (marker.Position.Value, m_directionsRadius)) {
                StartCoroutine (ComputeDirectionsFromUser (marker.Position.Value));
                return true;
            } else {
                if (m_userDirectionLine != null)
                    m_onlineMaps.RemoveDrawingElement (m_userDirectionLine);//this is where I remove the line
                return false;
            }
        }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[gamar]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=162</uri>
			</author>
			<updated>2016-08-24T14:07:39Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1150#p1150</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Null reference on clicking a marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1149#p1149" />
			<content type="html"><![CDATA[<p>Hello.</p><p>It looks as if you are deleting points of line instead of a line.<br />Please show the code where you are removing the line.</p><p>Of course, this is also an issue and it will be checked and fixed.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-08-24T11:28:15Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1149#p1149</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Null reference on clicking a marker]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1148#p1148" />
			<content type="html"><![CDATA[<p>Unity version - 5.1.4f1<br />iOS version - 9.3.4<br />Android version - 4.3<br />(I think phone/os is irrelevant in this matter)<br />Maps version - 2.5.0.3 (is a beta version I know, but I need it for another feature that only exists in the beta)</p><p>When I tap on a marker I get this null pointer exception.</p><p>Marker 1 is &quot;selected&quot; and when I tap on marker 4 I want to selected it. I delete a line while doing this and I get this crash which messes my flow of execution. </p><p>It only reproduces once. After that the map needs to be reloaded to be reproduced.</p><p>I can provide any info that you need further on. Can you please help? Thank you!</p><p><span class="postimg"><img src="http://i.imgur.com/SI3MPjM.png" alt="http://i.imgur.com/SI3MPjM.png" /></span><br /><span class="postimg"><img src="http://i.imgur.com/LO6sXQ3.png" alt="http://i.imgur.com/LO6sXQ3.png" /></span></p>]]></content>
			<author>
				<name><![CDATA[gamar]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=162</uri>
			</author>
			<updated>2016-08-24T10:30:40Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1148#p1148</id>
		</entry>
</feed>
