Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError thrown if getVariables() called on invalid LABEL #38

Closed
rcjsuen opened this issue May 27, 2018 · 0 comments
Closed

TypeError thrown if getVariables() called on invalid LABEL #38

rcjsuen opened this issue May 27, 2018 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented May 27, 2018

LABEL abc

While the above Dockerfile is not valid since a LABEL instruction must have a value associated with it, calling getVariables() on it shouldn't result in an error.

import { DockerfileParser } from 'dockerfile-ast';

const content = "LABEL abc";

let dockerfile = DockerfileParser.parse(content);
let variables = dockerfile.getInstructions()[0].getVariables();
console.log(variables.length);
$ node test.js
dockerfile-ast\out\src\instructions\label.js:17
            if (value.length > 2 && value.charAt(0) === '\'' && value.charAt(value.length - 1) === '\'') {
                      ^

TypeError: Cannot read property 'length' of null
    at Label.getVariables (dockerfile-ast\out\src\instructions\label.js:17:23)
    at Object.<anonymous> (dockerfile-ast\out\src\tmp.js:7:49)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
@rcjsuen rcjsuen added the bug label May 27, 2018
@rcjsuen rcjsuen self-assigned this May 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant