commit d9f7642bd7ed273e522a4bf88f9550abb53a31c4
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun Jan 15 12:48:43 2017 +0100

    Fix revert_bibpackopts lyx2lyx routine
---
 lib/lyx2lyx/lyx_2_3.py |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py
index 762c884..5b647db 100644
--- a/lib/lyx2lyx/lyx_2_3.py
+++ b/lib/lyx2lyx/lyx_2_3.py
@@ -1415,11 +1415,17 @@ def revert_bibpackopts(document):
     if engine not in ["natbib", "jurabib"]:
         return
 
-    biblio_options = ""
     i = find_token(document.header, "\\biblio_options", 0)
-    if i != -1:
-        biblio_options = get_value(document.header, "\\biblio_options", i)
-        del document.header[i]
+    if i == -1:
+        # Nothing to do if we have no options
+        return
+
+    biblio_options = get_value(document.header, "\\biblio_options", i)
+    del document.header[i]
+
+    if not biblio_options:
+        # Nothing to do for empty options
+        return
 
     i = find_token(document.header, "\\begin_local_layout", 0)
     if i == -1:

Reply via email to