diff --git a/HISTORY.rst b/HISTORY.rst index 17b53191..f165c8d6 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -17,6 +17,8 @@ PlatformIO 3.0 ~~~~~~~~~~~~~~~~~~ * Project Generator: fixed a VSCode C/C++'s "Cannot find" warning when CPPPATH folder does not exist +* Fixed an "IndexError: list index out of range" for Arduino sketch preprocessor + (`issue #2268 `_) 3.6.6 (2019-03-29) ~~~~~~~~~~~~~~~~~~ diff --git a/platformio/builder/tools/piomisc.py b/platformio/builder/tools/piomisc.py index e6f846e0..1118ac35 100644 --- a/platformio/builder/tools/piomisc.py +++ b/platformio/builder/tools/piomisc.py @@ -157,9 +157,7 @@ class InoToCPPConverter(object): return total def append_prototypes(self, contents): - prototypes = self._parse_prototypes(contents) - if not prototypes: - return contents + prototypes = self._parse_prototypes(contents) or [] # skip already declared prototypes declared = set( @@ -168,6 +166,9 @@ class InoToCPPConverter(object): m for m in prototypes if m.group(1).strip() not in declared ] + if not prototypes: + return contents + prototype_names = set(m.group(3).strip() for m in prototypes) split_pos = prototypes[0].start() match_ptrs = re.search(