Topic: NullRef in OnlineMapsMarker when creating markers

Hello Infinity Code, I am experiencing a problem with the Marker class, and it is causing my map to only display one marker.

NullReferenceException: Object reference not set to an instance of an object
OnlineMapsMarker.Init (System.Nullable`1[T] width, System.Nullable`1[T] height) (at Assets/OnlineMapsV3/Online maps/Scripts/Markers/Instances/OnlineMapsMarker.cs:379)

This is the exact error. I use the following method to create markers with two different filters:

public void PlaceMarkersOnMap(string eventTitleFilter) {
      markerManager.RemoveAll();
      foreach (MarkerData data in MarkerDataManager.Instance.MarkerData) {
        foreach (EventAtLocation eventAL in data.HostedEvents) {
          if (eventAL.EventType == mapType) {
            if (eventAL.EventTitle == eventTitleFilter) {
              markerManager.Create(new Vector2(data.Longitude, data.Latitude),
                markers[GetMarkerFromName(eventAL.EventTitle)],
                data.UID.ToString());
            }
          }
        }
      }
      this.gameObject.AddComponent<MarkerTouch>();
    }

This is the only method that controls marker creation. Can anyone identify this problem and recommend a solution? Thank you for the help!

Re: NullRef in OnlineMapsMarker when creating markers

Hello.

Your exception has a strange line.
Which version of Online Maps are you using?

Re: NullRef in OnlineMapsMarker when creating markers

The most recent. I saw the error line was related to a texture when the script is initializing. This makes sense as I am dynamically changing the marker texture based on a filter, but the texture is never null, malformed, or read/write disabled.

Re: NullRef in OnlineMapsMarker when creating markers

The latest version has the following lines:

375: if (texture != null)
376: {
377:     if (map.control.resultIsTexture) _colors = texture.GetPixels32();
378:     _width = _textureWidth = width ?? texture.width;
379:     _height = _textureHeight = height ?? texture.height;
380: }

Line 379 is equivalent to the following line:

_height = _textureHeight = height != null ? height.Value : texture.height;

This means that only texture can throw a NullReferenceException.
But, the texture cannot be null, because this is checked on line 375.

Please send me your project by email (support@infinity-code.com). I will check it.
To make it clear:
I don't need your working project. I need any temporary project where the problem is appears.

Re: NullRef in OnlineMapsMarker when creating markers

That is against company policy unfortunately, we are using this plugin in a professional setting.

Are there any other alternatives? This support request was simply to speed up the process of manually debugging the script(s). If there are none, that will be my next step. Thank you for the help so far

Re: NullRef in OnlineMapsMarker when creating markers

May I ask what exactly is against your company policy?
A new temporary project that contains only a map and part of a script enough to reproduce an exception?
I understand that projects are in most cases a corporate secret, and I do not ask you to send me work projects.
Please reread the last line of my previous post.

In general, there are three ways:
1. You send me a project and I debug it, fix the error on my side, or show you the error on your side.
2. I connect to you using TeamViewer or AnyDesc, and try to debug this on your side.
This is very inconvenient for me and for you, and requires discussion to schedule the time of the call, because you and I are in different time zones.
3. You debug it yourself. The difficulty and time of debugging depends on your programming skill, the complexity of the error, and your luck.