Просмотр исходного кода

Implement the fix for a file with no sharedStrings.xml as proposed by
HeinOldewage.

Geoffrey J. Teale 11 лет назад
Родитель
Сommit
0f709e079c
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      lib.go

+ 7 - 0
lib.go

@@ -629,6 +629,13 @@ func readSharedStringsFromZipFile(f *zip.File) ([]string, error) {
 	var rc io.ReadCloser
 	var decoder *xml.Decoder
 	var reftable []string
+
+	// In a file with no strings it's possible that
+	// sharedStrings.xml doesn't exist.  In this case the value
+	// passed as f will be nil.
+	if f == nil {
+		return make([]string,0), nil
+	}
 	rc, error = f.Open()
 	if error != nil {
 		return nil, error