mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-07-23 07:58:09 +02:00
2016-07-20 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'utils/rdclilogedit/rdclilogedit.cpp' that caused segfaults with certain commands when run without a log loaded.
This commit is contained in:
parent
27e674544c
commit
f4cf690ff3
@ -15334,3 +15334,6 @@
|
||||
* Added a 'settime' command to rdclilogedit(1) in
|
||||
'utils/rdclilogedit/rdclilogedit.cpp' and
|
||||
'utils/rdclilogedit/rdclilogedit.h'.
|
||||
2016-07-20 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Fixed a bug in 'utils/rdclilogedit/rdclilogedit.cpp' that caused
|
||||
segfaults with certain commands when run without a log loaded.
|
||||
|
@ -143,10 +143,6 @@ void MainObject::inputActivatedData(int sock)
|
||||
|
||||
void MainObject::Addcart(int line,unsigned cartnum)
|
||||
{
|
||||
if(edit_log_event==NULL) {
|
||||
fprintf(stderr,"addcart: no log loaded\n");
|
||||
return;
|
||||
}
|
||||
if(edit_user->addtoLog()) {
|
||||
if(line>edit_log_event->size()) {
|
||||
line=edit_log_event->size();
|
||||
@ -204,10 +200,6 @@ void MainObject::Load(const QString &logname)
|
||||
|
||||
void MainObject::List()
|
||||
{
|
||||
if(edit_log_event==NULL) {
|
||||
fprintf(stderr,"list: no log loaded\n");
|
||||
return;
|
||||
}
|
||||
for(int i=0;i<edit_log_event->size();i++) {
|
||||
printf("%4d %s\n",i,(const char *)ListLine(edit_log_event,i));
|
||||
}
|
||||
@ -223,10 +215,6 @@ void MainObject::Remove(int line)
|
||||
|
||||
void MainObject::Save()
|
||||
{
|
||||
if(edit_log_event==NULL) {
|
||||
fprintf(stderr,"save: no log loaded\n");
|
||||
return;
|
||||
}
|
||||
if(edit_user->arrangeLog()) {
|
||||
edit_log_event->save();
|
||||
edit_log->
|
||||
@ -243,10 +231,6 @@ void MainObject::Saveas(const QString &logname)
|
||||
QString sql;
|
||||
RDSqlQuery *q;
|
||||
|
||||
if(edit_log_event==NULL) {
|
||||
fprintf(stderr,"save: no log loaded\n");
|
||||
return;
|
||||
}
|
||||
if(edit_user->arrangeLog()) {
|
||||
RDLog *log=new RDLog(logname);
|
||||
if(!log->exists()) {
|
||||
@ -280,10 +264,6 @@ void MainObject::Saveas(const QString &logname)
|
||||
|
||||
void MainObject::Setcart(int line,unsigned cartnum)
|
||||
{
|
||||
if(edit_log_event==NULL) {
|
||||
fprintf(stderr,"setcart: no log loaded\n");
|
||||
return;
|
||||
}
|
||||
if(edit_user->arrangeLog()) {
|
||||
RDLogLine *logline=edit_log_event->logLine(line);
|
||||
if(logline!=NULL) {
|
||||
@ -308,10 +288,6 @@ void MainObject::Setcart(int line,unsigned cartnum)
|
||||
|
||||
void MainObject::Settime(int line,RDLogLine::TimeType type,const QTime &time)
|
||||
{
|
||||
if(edit_log_event==NULL) {
|
||||
fprintf(stderr,"settime: no log loaded\n");
|
||||
return;
|
||||
}
|
||||
edit_log_event->logLine(line)->setTimeType(type);
|
||||
edit_log_event->logLine(line)->setStartTime(RDLogLine::Logged,time);
|
||||
}
|
||||
@ -346,6 +322,37 @@ void MainObject::DispatchCommand(const QString &cmd)
|
||||
QTime time;
|
||||
bool ok=false;
|
||||
|
||||
//
|
||||
// No loaded log needed for these
|
||||
//
|
||||
if((verb=="exit")||(verb=="quit")||(verb=="bye")) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if((verb=="help")||(verb=="?")) {
|
||||
Help(cmds);
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if(verb=="listlogs") {
|
||||
ListLogs();
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if(verb=="load") {
|
||||
if(cmds.size()==2) {
|
||||
Load(cmds[1]);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,"load: invalid command arguments\n");
|
||||
}
|
||||
processed=true;
|
||||
}
|
||||
|
||||
//
|
||||
// These need a log loaded
|
||||
//
|
||||
if((processed)||(edit_log_event!=NULL)) {
|
||||
if(verb=="addcart") {
|
||||
if(cmds.size()==3) {
|
||||
line=cmds[1].toInt(&ok);
|
||||
@ -368,35 +375,11 @@ void MainObject::DispatchCommand(const QString &cmd)
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if((verb=="exit")||(verb=="quit")||(verb=="bye")) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if((verb=="help")||(verb=="?")) {
|
||||
Help(cmds);
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if(verb=="listlogs") {
|
||||
ListLogs();
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if(verb=="list") {
|
||||
List();
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if(verb=="load") {
|
||||
if(cmds.size()==2) {
|
||||
Load(cmds[1]);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,"load: invalid command arguments\n");
|
||||
}
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if(verb=="remove") {
|
||||
if(cmds.size()==2) {
|
||||
line=cmds[1].toInt(&ok);
|
||||
@ -534,6 +517,11 @@ void MainObject::DispatchCommand(const QString &cmd)
|
||||
Unload();
|
||||
processed=true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
fprintf(stderr,"%s: no log loaded\n",(const char *)verb);
|
||||
processed=true;
|
||||
}
|
||||
|
||||
if(!processed) {
|
||||
fprintf(stderr,"invalid command\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user