openframeworks / openframeworks/projectGenerator

Frontend exception on undefined macro

Open
#284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CSS
Stars
90
Forks
79
Avg merge
2d 9h
Merged PRs (30d)
5

Description

On macOS 11.6.1 on M1 MBP 13 using OF 0.11.2 release PG.

The Electron frontend throws an exception when parsing macros in config.make while importing an existing project:

Screen Shot 2022-02-13 at 11 42 49 PM

Exception backtrace copy/paste:

Uncaught Exception:
TypeError: Cannot read property 'length' of undefined
at /Users/danomatika/src/of/of_v0.11.2_osx_release/projectGenerator/projectGenerator.app/Contents/Resources/app/index.js:577:30
at Array.forEach (native)
at EventEmitter.<anonymous> (/Users/danomatika/src/of/of_v0.11.2_osx_release/projectGenerator/projectGenerator.app/Contents/Resources/app/index.js:556:30)
at emitTwo (events.js:87:13)
at EventEmitter.emit (events.js:172:7)
at EventEmitter.<anonymous> (/Users/danomatika/src/of/of_v0.11.2_osx_release/projectGenerator/projectGenerator.app/Contents/Resources/atom.asar/browser/api/lib/web-contents.js:54:23)
at emitTwo (events.js:87:13)
at EventEmitter.emit (events.js:172:7)

This appears to be due to some custom makefile stuff added to the end of the affected config.make.

Without looking into detail, adding an undefined check for the macro variable to https://github.com/openframeworks/projectGenerator/blob/master/frontend/index.js#L577 allows the PG to finish importing the project successfully:

if(macro !== undefined && macro.length && value.length){

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in frontend/index.js around line 577 and reproduce the failure by importing the linked loaf project, whose config.make contains custom makefile content near its end. Trace the macro parsing that produces the undefined value and verify that importing the project completes without an exception after the fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.