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

Calling getAvailableVariables() on a Dockerfile with an invalid line number will throw an error #23

Closed
rcjsuen opened this issue Apr 15, 2018 · 0 comments
Assignees
Labels

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Apr 15, 2018

We don't perform any argument checking for getAvailableVariables() so an invalid line number will cause an error to be thrown.

import { DockerfileParser } from 'dockerfile-ast';

const content =
`FROM alpine`

let dockerfile = DockerfileParser.parse(content);
let variables = dockerfile.getAvailableVariables(1);
$ node out.js
dockerfile.js:116
        return image.getAvailableVariables(currentLine);
                     ^

TypeError: Cannot read property 'getAvailableVariables' of null
    at Dockerfile.getAvailableVariables (dockerfile.js:116:22)
    at Object.<anonymous> (out.js:6:28)
    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 Apr 15, 2018
@rcjsuen rcjsuen self-assigned this Apr 15, 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