From 36050c5587e30c0e0b740166c73c2d145c3471d1 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Wed, 30 Apr 2008 23:38:25 +0000
Subject: [PATCH] Fix for issue where deleteing the last few entries indexed by a VLV index might cause a NPE.

---
 opends/src/server/org/opends/server/backends/jeb/SortValuesSet.java |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/SortValuesSet.java b/opends/src/server/org/opends/server/backends/jeb/SortValuesSet.java
index 94bf340..8fd9d1b 100644
--- a/opends/src/server/org/opends/server/backends/jeb/SortValuesSet.java
+++ b/opends/src/server/org/opends/server/backends/jeb/SortValuesSet.java
@@ -346,10 +346,16 @@
   /**
    * Encode this set to its database format.
    *
-   * @return The encoded bytes representing this set.
+   * @return The encoded bytes representing this set or null if
+   * this set is empty.
    */
   public byte[] toDatabase()
   {
+    if(size() == 0)
+    {
+      return null;
+    }
+
     byte[] entryIDBytes = JebFormat.entryIDListToDatabase(entryIDs);
     byte[] concatBytes = new byte[entryIDBytes.length + valuesBytes.length + 4];
     int v = entryIDs.length;

--
Gitblit v1.10.0