Protect against faulty or missing tsil.3q file.

This commit is contained in:
Joe Taylor 2023-02-20 14:19:38 -05:00
parent 92c9dd7fd6
commit 16f9f50263
4 changed files with 51 additions and 36 deletions

View File

@ -20,7 +20,12 @@ subroutine get_q3list(fname,nlist,list)
nhist2=0 nhist2=0
open(24,file=fname,status='unknown',form='unformatted') open(24,file=fname,status='unknown',form='unformatted')
read(24,end=1) nhist2,callers(1:nhist2) read(24,end=1) nhist2
if(nhist2.ge.1 .and. nhist2.le.40) then
read(24,end=1) callers(1:nhist2)
else
nhist2=0
endif
1 close(24) 1 close(24)
now=time() now=time()

View File

@ -115,7 +115,9 @@ contains
! NA VHF, WW-Digi, or ARRL Digi Contest ! NA VHF, WW-Digi, or ARRL Digi Contest
open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', & open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', &
form='unformatted') form='unformatted')
read(24,end=2) nhist2,callers(1:nhist2) read(24,end=2) nhist2
if(nhist2.ge.1 .and. nhist2.le.40) then
read(24,end=2) callers(1:nhist2)
now=time() now=time()
do i=1,nhist2 do i=1,nhist2
hours=(now - callers(i)%nsec)/3600.0 hours=(now - callers(i)%nsec)/3600.0
@ -124,6 +126,9 @@ contains
nhist2=nhist2-1 nhist2=nhist2-1
endif endif
enddo enddo
else
nhist2=0
endif
2 close(24) 2 close(24)
endif endif

View File

@ -913,10 +913,13 @@ subroutine q65_hist2(nfreq,msg0,callers,nhist2)
callers(nhist2)%nfreq=nfreq callers(nhist2)%nfreq=nfreq
endif endif
if(nhist2.ge.1 .and. nhist2.le.40) then
open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', & open(24,file=trim(data_dir)//'/tsil.3q',status='unknown', &
form='unformatted') form='unformatted')
write(24) nhist2,callers(1:nhist2) write(24) nhist2
write(24) callers(1:nhist2)
close(24) close(24)
endif
900 return 900 return
end subroutine q65_hist2 end subroutine q65_hist2

View File

@ -59,6 +59,7 @@ void ActiveStations::write_settings ()
void ActiveStations::displayRecentStations(QString mode, QString const& t) void ActiveStations::displayRecentStations(QString mode, QString const& t)
{ {
if(mode!=m_mode) {
m_mode=mode; m_mode=mode;
if(m_mode=="Q65") { if(m_mode=="Q65") {
ui->header_label2->setText(" N Frx Fsked S/N Call Grid Tx Age"); ui->header_label2->setText(" N Frx Fsked S/N Call Grid Tx Age");
@ -76,12 +77,13 @@ void ActiveStations::displayRecentStations(QString mode, QString const& t)
ui->label_3->setVisible(!b); ui->label_3->setVisible(!b);
ui->score->setVisible(!b); ui->score->setVisible(!b);
ui->sbMaxRecent->setVisible(!b); ui->sbMaxRecent->setVisible(!b);
ui->RecentStationsPlainTextEdit->insertPlainText(t);
b=(m_mode!="Q65-pileup"); b=(m_mode!="Q65-pileup");
ui->sbMaxAge->setVisible(b); ui->sbMaxAge->setVisible(b);
ui->label->setVisible(b); ui->label->setVisible(b);
ui->rate->setVisible(b); ui->rate->setVisible(b);
}
ui->RecentStationsPlainTextEdit->insertPlainText(t);
} }
int ActiveStations::maxRecent() int ActiveStations::maxRecent()