Skip to content

os.read_entire_file: program crashes when file is completely empty. #31

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

Closed
Krognol opened this issue Apr 3, 2017 · 1 comment
Closed

Comments

@Krognol
Copy link

Krognol commented Apr 3, 2017

#import os "os.odin";
#import fmt "fmt.odin";

main :: proc()  {
    fpath := os.args[0];
    // Crashes when file is completely empty
    file, ok := os.read_entire_file(fpath);
    if !ok {
        fmt.println("error opening file");
        return;
    }
}

Error: C:\Odin\core\os_windows.odin(217:11) Index 0 is out of bounds range 0..0

@Krognol
Copy link
Author

Krognol commented Apr 3, 2017

#32

gingerBill added a commit that referenced this issue Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants