From b7fc5b1715927eb02b41892ca3f43708a09fc179 Mon Sep 17 00:00:00 2001 From: Doni Pracner Date: Fri, 25 May 2018 23:16:10 +0200 Subject: [PATCH] StekIFajlovi, dodatne provere za fajl i stek --- kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java b/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java index 5685b7a..9f12b74 100644 --- a/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java +++ b/kodovi/stek-i-red-opsluzivanja/StekIFajlovi.java @@ -18,12 +18,13 @@ public class StekIFajlovi { public static Stek ucitajStek(String imef) { Stek rez = new Stek(); - 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; } -- 2.25.1