New topic: 

NIlObjectException — No there isn't?

<http://forums.realsoftware.com/viewtopic.php?t=45162>

         Page 1 of 1
   [ 1 post ]                 Previous topic | Next topic          Author  
Message        Jason_Adams          Post subject: NIlObjectException — No 
there isn't?Posted: Wed Aug 29, 2012 7:28 am                                 
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1647
Location: Michigan, USA                I have an odd one, here. I have a class, 
Interval, which is almost exactly like a Date object, but measures lengths of 
time (e.g. 5 hours, 2 minutes, 1 second). The class has a conversion method for 
strings:

Sub Operator_Convert(Text As String)
  Dim Reg As New RegEx
  Dim Match As RegExMatch
  
  // Find HH:MM:SS
  Reg.SearchPattern = "([0-9][0-9]):([0-9][0-9]):([0-9][0-9])"
  Match = Reg.Search(Text)
  
  If Not (Match Is Nil) Then
  Hours = Match.SubExpressionString(0).Val
  Minutes = Match.SubExpressionString(1).Val
  Seconds = Match.SubExpressionString(2).Val
  End If
  
  Days = FindValue(Text, "days")
  Weeks = FindValue(Text, "weeks")
  Months = FindValue(Text, "months")
  Years = FindValue(Text, "years")
End Sub


This works great. When I do MyInterval = "05:02:01", the appropriate properties 
are adjusted.

Here's the problem: Later, when I try to convert the class back to the string 
(another Operator_Convert), I get a NilObjectException... The strange thing is 
that the debugger sees the object, and I can view its properties. There's no 
objects in the Operator_Convert that could be causing the issue, and all the 
other objects in play are working... It doesn't see the Interval object.

Any thoughts?     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2011r4

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 1 post ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to