From 180ff95649bf206bff02b0f572293b616bc15668 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 10 Jun 2012 15:21:55 -0400 Subject: [PATCH] Bug #1017 - Fixed bug #1017, which exported invalid JSON when there were no tasks (thanks to Nicholas Rabenau). --- ChangeLog | 2 ++ src/commands/CmdExport.cpp | 17 ++++++----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f0003549..8ba5c97e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -78,6 +78,8 @@ Bugs Bryan Kam). + Fixed bug #1016, which caused segfaults when importing JSON with annotations that lack description or entry date (thanks to Nicholas Rabenau). + + Fixed bug #1017, which exported invalid JSON when there were no tasks (thanks + to Nicholas Rabenau). ------ old releases ------------------------------ diff --git a/src/commands/CmdExport.cpp b/src/commands/CmdExport.cpp index cf8c3b821..32b38ce13 100644 --- a/src/commands/CmdExport.cpp +++ b/src/commands/CmdExport.cpp @@ -53,12 +53,6 @@ int CmdExport::execute (std::string& output) std::vector filtered; filter (filtered); - if (filtered.size () == 0) - { - context.footnote (STRING_FEEDBACK_NO_MATCH); - return 1; - } - // Note: "limit:" feature not supported. // TODO Why not? @@ -72,16 +66,17 @@ int CmdExport::execute (std::string& output) std::vector ::iterator task; for (task = filtered.begin (); task != filtered.end (); ++task) { - if (task != filtered.begin ()) - output += ",\n"; - output += task->composeJSON (true); + + if (task != filtered.begin ()) + output += ","; + + output += "\n"; } if (json_array) - output += "\n]"; + output += "]\n"; - output += "\n"; return rc; }