File tree 2 files changed +9
-0
lines changed
arduino/libraries/librariesindex
2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change 16
16
package librariesindex
17
17
18
18
import (
19
+ "fmt"
19
20
"sort"
20
21
21
22
"github.com/arduino/arduino-cli/arduino/libraries"
@@ -136,6 +137,10 @@ func (idx *Index) FindLibraryUpdate(lib *libraries.Library) *Release {
136
137
if indexLib == nil {
137
138
return nil
138
139
}
140
+ if lib .Version == nil {
141
+ fmt .Printf ("[WARN] version for library loaded from %s is nil\n " , lib .InstallDir )
142
+ return indexLib .Latest
143
+ }
139
144
if indexLib .Latest .Version .GreaterThan (lib .Version ) {
140
145
return indexLib .Latest
141
146
}
Original file line number Diff line number Diff line change @@ -78,6 +78,10 @@ func TestIndexer(t *testing.T) {
78
78
require .NotNil (t , rtcUpdate )
79
79
require .Equal (t , "RTCZero@1.6.0" , rtcUpdate .String ())
80
80
81
+ rtcUpdateNoVersion := index .FindLibraryUpdate (& libraries.Library {Name : "RTCZero" , Version : nil })
82
+ require .NotNil (t , rtcUpdateNoVersion )
83
+ require .Equal (t , "RTCZero@1.6.0" , rtcUpdateNoVersion .String ())
84
+
81
85
rtcNoUpdate := index .FindLibraryUpdate (& libraries.Library {Name : "RTCZero" , Version : semver .MustParse ("3.0.0" )})
82
86
require .Nil (t , rtcNoUpdate )
83
87
You can’t perform that action at this time.
0 commit comments