touchsquid Active Member Licensed User Longtime User Feb 13, 2011 #1 If BrandIDList.Size > 0 Then For i = 0 To BrandIDList.Size-1 SQ1 = "select BrandName from M_Brands where BrandID = " & QUOTE & BrandIDList.Get(i) & QUOTE BrandList.Add(SQL1.ExecQuerySingleResult(SQ1)) Next Brandlist.Sort(True) End If Return BrandList This code crashes on the sort command with a java.nullpointerexception. If I comment out the sort the code works OK but the list is of course not sorted. Any ideas? It is a simple list of strings.
If BrandIDList.Size > 0 Then For i = 0 To BrandIDList.Size-1 SQ1 = "select BrandName from M_Brands where BrandID = " & QUOTE & BrandIDList.Get(i) & QUOTE BrandList.Add(SQL1.ExecQuerySingleResult(SQ1)) Next Brandlist.Sort(True) End If Return BrandList This code crashes on the sort command with a java.nullpointerexception. If I comment out the sort the code works OK but the list is of course not sorted. Any ideas? It is a simple list of strings.
Erel B4X founder Staff member Licensed User Longtime User Feb 13, 2011 #2 SQL.ExecQuerySingleResult returns Null if there is no result. You are adding the Null value to the list and then it fails when you try to sort it.
SQL.ExecQuerySingleResult returns Null if there is no result. You are adding the Null value to the list and then it fails when you try to sort it.