Fix a possible NullPointerException
This commit is contained in:
parent
e7b9f75035
commit
8d50ce6725
@ -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);
|
||||
|
Reference in New Issue
Block a user