diff --git a/src/debug.c b/src/debug.c index 0ab864e7f..26ea41323 100644 --- a/src/debug.c +++ b/src/debug.c @@ -347,7 +347,11 @@ NULL serverLog(LL_WARNING,"DB reloaded by DEBUG RELOAD"); addReply(c,shared.ok); } else if (!strcasecmp(c->argv[1]->ptr,"loadaof")) { - if (server.aof_state == AOF_ON) flushAppendOnlyFile(1); + if (server.aof_state == AOF_OFF) { + addReply(c, shared.err); + return; + } + flushAppendOnlyFile(1); emptyDb(-1,EMPTYDB_NO_FLAGS,NULL); if (loadAppendOnlyFile(server.aof_filename) != C_OK) { addReply(c,shared.err);