Skip to content

Commit 7607915

Browse files
committed
Avoid error when no examples directory exists
1 parent da93905 commit 7607915

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
### Removed
1616

1717
### Fixed
18+
- A missing `examples` directory no longer causes a crash in `cpp_library.rb`
1819

1920
### Security
2021

Diff for: lib/arduino_ci/cpp_library.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ def info
132132
# @param installed_library_path [String] The library to query
133133
# @return [Array<String>] Example sketch files
134134
def example_sketches
135-
reported_dirs = info["library"]["examples"].map(&Pathname::method(:new))
135+
examples = info["library"]["examples"]
136+
return [] if examples.nil?
137+
138+
reported_dirs = examples.map(&Pathname::method(:new))
136139
reported_dirs.map { |e| e + e.basename.sub_ext(".ino") }.select(&:exist?).sort_by(&:to_s)
137140
end
138141

0 commit comments

Comments
 (0)