1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-09 01:05:38 +02:00

Catch the exception and use a list.

This commit is contained in:
Alain Magloire 2002-11-06 21:04:57 +00:00
parent 6c34b97f04
commit f1009943f6

View file

@ -93,7 +93,7 @@ public class StackFrame extends CObject implements ICDIStackFrame {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariables() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariables()
*/ */
public ICDIVariable[] getLocalVariables() throws CDIException { public ICDIVariable[] getLocalVariables() throws CDIException {
ICDIVariable[] variables = null; List cdiList = new ArrayList();
CSession session = getCTarget().getCSession(); CSession session = getCTarget().getCSession();
VariableManager mgr = (VariableManager)session.getVariableManager(); VariableManager mgr = (VariableManager)session.getVariableManager();
MISession mi = session.getMISession(); MISession mi = session.getMISession();
@ -109,12 +109,12 @@ public class StackFrame extends CObject implements ICDIStackFrame {
} }
args = info.getLocals(); args = info.getLocals();
if (args != null) { if (args != null) {
variables = new ICDIVariable[args.length]; for (int i = 0; i < args.length; i++) {
for (int i = 0; i < variables.length; i++) { try {
variables[i] = mgr.createVariable(this, args[i].getName()); cdiList.add(mgr.createVariable(this, args[i].getName()));
} catch (CDIException e) {
}
} }
} else {
variables = new ICDIVariable[0];
} }
} catch (MIException e) { } catch (MIException e) {
//throw new CDIException(e.getMessage()); //throw new CDIException(e.getMessage());
@ -123,10 +123,7 @@ public class StackFrame extends CObject implements ICDIStackFrame {
//throw e; //throw e;
//System.err.println(e); //System.err.println(e);
} }
if (variables == null) { return (ICDIVariable[])cdiList.toArray(new ICDIVariable[0]);
variables = new ICDIVariable[0];
}
return variables;
} }
/** /**