Skip to content

Commit

Permalink
Invalid File FIx
Browse files Browse the repository at this point in the history
Has program exit upon selection of invalid file type
  • Loading branch information
esundbla committed Mar 29, 2022
1 parent cf69b8b commit d5654ca
Show file tree
Hide file tree
Showing 9 changed files with 190 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions imagelab/ImgProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ public ImgProvider() {
* @param name The name of the file containing the image
*/
public ImgProvider(final String name) {
imgName = name;
isLoaded = false;
id = ++count;
if(name.contains(".jpg") || name.contains(".gif")){
imgName = name;
isLoaded = false;
id = ++count;}
else {
System.out.println("Not a valid filetype (jpg, gif)");
System.exit(0);
}
}

/**
Expand Down

0 comments on commit d5654ca

Please sign in to comment.