Fixed bug when sorting empty input

git-svn-id: https://hyracks.googlecode.com/svn/trunk/hyracks@227 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortRunMerger.java b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortRunMerger.java
index 91114b2..87c021b 100644
--- a/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortRunMerger.java
+++ b/hyracks-dataflow-std/src/main/java/edu/uci/ics/hyracks/dataflow/std/sort/ExternalSortRunMerger.java
@@ -69,7 +69,7 @@
         }
         try {
             if (runs.size() <= 0) {
-                if (frameSorter != null) {
+                if (frameSorter != null && frameSorter.getFrameCount() > 0) {
                     frameSorter.flushFrames(writer);
                 }
             } else {