SDK Question Handle to other Vessel (exception)

huddi

New member
Joined
Apr 20, 2009
Messages
38
Reaction score
0
Points
0
Hi,

if I validly call oapiGetVesselByIndex everything is all right.
But if there is no Object for the Index entered, the program crashes.

this
Code:
try
{
...
}
catch(...){};
does not work. What else can I do?

Thanks,
Huddi
 
Last edited:
The function probably doesn't crash in its own right. If the index specified doesn't exist, the handle returned is NULL (0). You need to check the value of this handle before you use it as it is likely this that is causing the exception. I don't think that the orbiter core throws exceptions, so a catch is not likely to work.
 
I think there is oapiGetNumberOfVessels() or something like that (check in API_Reference.pdf), which will return the number of vessels currently in simulation.
 
The function probably doesn't crash in its own right. If the index specified doesn't exist, the handle returned is NULL (0). You need to check the value of this handle before you use it as it is likely this that is causing the exception. I don't think that the orbiter core throws exceptions, so a catch is not likely to work.

Thanks! This is right

I think there is oapiGetNumberOfVessels() or something like that (check in API_Reference.pdf), which will return the number of vessels currently in simulation.

The function is called oapiGetVesselCount()
Thanks too!
 
Back
Top