}
int count = 0;
while (it != null && it.hasNext()) {
Program p = it.next();
int start = p.getStartTime();
int end = p.getStartTime() + p.getLength();
if (start <= time && time < end && MainFrame.getInstance().getProgramFilter().accept(p)) {
programs.add(new ProgramMenuItem(p, ProgramMenuItem.ON_TIME_TYPE, time, -1));
if (p.getMarkerArr().length > 0
&& p.getMarkPriority() >= Settings.propTrayImportantProgramsPriority.getInt()) {
additional.add(new ProgramMenuItem(p, ProgramMenuItem.ON_TIME_TYPE, time, -1));
}
} else if (start > time && day == 1 && count == 0) {
int temptime = time + 24 * 60;
try {
ChannelDayProgram dayProg = TvDataBase.getInstance().getDayProgram(currentDate, ch);
p = dayProg.getProgramAt(dayProg.getProgramCount() - 1);
start = p.getStartTime();
end = p.getStartTime() + p.getLength();
if (start <= temptime && temptime < end && MainFrame.getInstance().getProgramFilter().accept(p)) {
programs.add(new ProgramMenuItem(p, ProgramMenuItem.ON_TIME_TYPE, time, -1));
if (p.getMarkerArr().length > 0
&& p.getMarkPriority() >= Settings.propTrayImportantProgramsPriority.getInt()) {
additional.add(new ProgramMenuItem(p, ProgramMenuItem.ON_TIME_TYPE, time, -1));
}
}
} catch (Exception ee) {
}