Making a little research on that..<div><br></div><div>I&#39;ve seen that there is a ticket that seems to be similar to my issue..</div><div><br></div><div><a href="http://trac.osgeo.org/openlayers/ticket/1806">http://trac.osgeo.org/openlayers/ticket/1806</a> </div>
<div><br></div><div>Could this be related?</div><div><br></div><div>Thanks!</div><div><br></div><div><br><br><div class="gmail_quote">El 28 de març de 2012 17:04, jkm <span dir="ltr">&lt;<a href="mailto:rifins@gmail.com">rifins@gmail.com</a>&gt;</span> ha escrit:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi,</div><div><br></div><div>I would like to know if I&#39;m doing something wrong, or not..</div><div><br></div><div>
I have a cluster strategy associated to a vector layer.. And I select and unselect features  with the &quot;selectCtrl&quot;:</div>
<div>   selectCtrl = new OpenLayers.Control.SelectFeature(layerTest, { onSelect: onFeatureSelect, onUnselect: onFeatureUnselect });</div><div>   map.addControl(selectCtrl);</div><div>   selectCtrl.activate();</div><div><br>

</div><div>When I select a feature I do:</div><div><br></div><div>function onFeatureSelect(feature) {</div><div>    selectedFeature = feature;</div><div>    if (currentPopup) currentPopup.hide();</div><div>    if (!feature.cluster) {</div>

<div>        if (!feature.popup) {</div><div>            popup = new OpenLayers.Popup.FramedCloud(&quot;chicken&quot;, feature.data.point, null, <a href="http://feature.data.info" target="_blank">feature.data.info</a>, null, true, onPopupClose);</div>

<div>            feature.popup = popup;</div><div>        }</div><div>        else { popup = feature.popup; }</div><div>    }</div><div>    else {</div><div>        var txt = &#39;Clustered feature&#39;;</div><div>        if (!feature.popup) {</div>

<div>            popup = new OpenLayers.Popup.FramedCloud(&quot;chicken&quot;, feature.cluster[0].data.point, null, txt, null, true, onPopupClose);</div><div>            feature.popup = popup;</div><div>        }</div><div>

        else { popup = feature.popup; }</div><div>    }</div><div>    map.addPopup(popup);</div><div>    currentPopup = popup;</div><div>}</div><div><br></div><div>What I pretend is to show a popup indicating the information of a single point, or indicate that the point is a cluster of different features.</div>

<div><br></div><div><br></div><div>When I unselect a feature, I do:</div><div><br></div><div>function onFeatureUnselect(feature) {</div><div>    if (currentPopup) {</div><div>        currentPopup.hide();</div><div>    }</div>

<div>    if (currentPopup = feature.popup) {</div><div>        map.removePopup(feature.popup);</div><div>        feature.popup.destroy();</div><div>        feature.popup = null;</div><div>        currentPopup = undefined;</div>

<div>    }</div><div>}</div><div><br></div><div>If the feature has an associated popup, I destroy it.</div><div><br></div><div>But, if I show a popup for a feature and I zoom in or out making feature changing (because there are more features clustered, or on the other side, the cluster doesn&#39;t exist anymore), when I unselect the feature, I get an error in Openlayers.js, in the unhighlight function:</div>

<div>&quot;layer.drawFeature(feature,feature.style||feature.layer.style||&quot;default&quot;);&quot; And this is due to the feature.layer is null...</div><div><br></div><div>I don&#39;t know if i&#39;m definig something in a bad way, or what is happening here.. Any help will be apreciated.</div>

<div><br></div><div>Thanks!</div>
</blockquote></div><br></div>