gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
StekIFajlovi, dodatne provere za fajl i stek
authorDoni Pracner <quinnuendo@gmail.com>
Fri, 25 May 2018 21:16:10 +0000 (23:16 +0200)
committerDoni Pracner <quinnuendo@gmail.com>
Fri, 25 May 2018 21:16:10 +0000 (23:16 +0200)
kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java

index 5685b7af1dfad450e022a03b58b1523eaa8f13e8..9f12b740014d7c7a5c0b890bc5173c95be638a3e 100644 (file)
@@ -18,12 +18,13 @@ public class StekIFajlovi {
        public static Stek<Integer> ucitajStek(String imef) {
                Stek<Integer> rez = new Stek<Integer>();
 
-               while (!Svetovid.in(imef).isEmpty()) {
+               if (Svetovid.testIn(imef)) {
+                   while (!Svetovid.in(imef).isEmpty() && !rez.jePun()) {
                        int broj = Svetovid.in(imef).readInt();
                        rez.stavi(broj);
+                   }
+                   Svetovid.in(imef).close();
                }
-               Svetovid.in(imef).close();
-
                return rez;
        }
 
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner