diff --git a/src/main/java/fr/ntr/scheduler/ProportionalFair.java b/src/main/java/fr/ntr/scheduler/ProportionalFair.java index 8ed0cb8..4b0c411 100644 --- a/src/main/java/fr/ntr/scheduler/ProportionalFair.java +++ b/src/main/java/fr/ntr/scheduler/ProportionalFair.java @@ -30,11 +30,11 @@ public class ProportionalFair extends Scheduler { avg = avg / (bandwidthTable.length * bandwidthTable[0].length); averageBandwiths.add(avg); } - User selectedUser = null; + User selectedUser; for(int ts = 0; ts < 2; ts++){ for(int sp = 0; sp < 100; sp++){ selectedUser = selectionUtilisateur(ts, sp, users, averageBandwiths); - if (selectedUser.getPacketsToSend().size() != 0) { + if (selectedUser != null && !selectedUser.getPacketsToSend().isEmpty()) { selectedUser.getPacketsSent().add(selectedUser.getPacketsToSend().get(0)); selectedUser.getPacketsToSend().remove(selectedUser.getPacketsToSend().get(0)); frame[ts][sp].setUser(selectedUser);