Bug? B4J 5.50 SmartString with If Then on one line

Discussion in 'B4J Bugs & Wishlist' started by mindful, Apr 19, 2017.

  1. mindful

    mindful Active Member Licensed User

    The below code produces error: 'Object reference not set to an instance of an object' in B4J 5.5
    Code:
    Public Sub NavigateToPage(WebSocketObject As WebSocket, PageId As String, TargetUrl As String)
        
    If Version.Length > 0 Then TargetUrl = $"${TargetUrl}?${Version}"$     ' <-- This line produces the error
        If PageId.Length > 0 Then ABM.RemoveMeFromCache(CachedPages, PageId)
        
    If WebSocketObject.Open Then
            
    If Settings.BrowserKeepsNavigationHistory Then
                
    ' it keeps the navigation history in the browser
                WebSocketObject.Eval("window.location = arguments[0]"Array As Object(TargetUrl))
            
    Else
                
    ' it doesn't keep navigation history in the browser (the back button exists the application)
                WebSocketObject.Eval("window.location.replace(arguments[0])"Array As Object(TargetUrl)) 
            
    End If
            WebSocketObject.Flush
        
    End If
    End Sub
    If I modify the line into:
    Code:
    If Version.Length > 0 Then 
            TargetUrl = 
    $"${TargetUrl}?${Version}"$
        
    End If
    There is no error.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Fixed for the next update.
     
    Cableguy and mindful like this.
  3. Cableguy

    Cableguy Expert Licensed User

    was about to report the same... You should also add a few Tags to the post, so that it can be found, as that code line refers to ABMaterial
     
Loading...