Bug #1549: Avoid exception avoiding checking lines resource if there are no lines

In
ExpenseSheet.checkConstraintPersonalExpenseSheetMustHaveTheSameResourceInAllLines
we check that the resource is the same in all the lines. However, if there are
no lines an exception arises.

FEA: ItEr77S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2012-10-25 14:10:24 +02:00
parent 283cab8d23
commit 47600797d8

View file

@ -244,6 +244,10 @@ public class ExpenseSheet extends IntegrationEntity implements IHumanIdentifiabl
return true;
}
if (expenseSheetLines.isEmpty()) {
return true;
}
Resource resource = expenseSheetLines.iterator().next().getResource();
for (ExpenseSheetLine line : expenseSheetLines) {