MantisBT - JANA
View Issue Details
0000412JANAFeature Requestpublic2014-07-18 08:192014-07-18 08:30
davidl 
davidl 
normalminorhave not tried
resolvedfixed 
0000412: Set pointer to NULL in JEventLoop::GetSingle if 0 values.

From an e-mail from Paul Mattione on June 7, 2014

===========================================
In JEventLoop::GetSingle(), could you set the pointer to NULL if the vector is empty, and only throw an exception if the size is >= 2? (Current is to throw if size != 1). I've been using GetSingle() for DMCThrownMatching, and checking for NULL after the function call, but it throws on (CLAS) experimental data.

Thanks.

- Paul
===========================================
No tags attached.
Issue History
2014-07-18 08:19davidlNew Issue
2014-07-18 08:30davidlNote Added: 0000592
2014-07-18 08:30davidlStatusnew => resolved
2014-07-18 08:30davidlResolutionopen => fixed
2014-07-18 08:30davidlAssigned To => davidl

Notes
(0000592)
davidl   
2014-07-18 08:30   
This was fixed in svn revision 2046 and will appear in JANA 0.7.2

The code now sets the value of "t" to NULL in all cases where there is not exactly one object of the requested type. It also has a 3rd parameter that can be used to disable throwing an exception if N!=1.