From 04dfea1556bc51ed30970aaaa990af14ed8822b7 Mon Sep 17 00:00:00 2001 From: Alistair Adcroft Date: Thu, 15 Jun 2017 23:36:19 -0400 Subject: [PATCH] Fix for when restart files have zero bergs - When the restart file exists but has zero length data in then the model was correctly NOT allocating but was then proceeding to try and read into the non-allocated array. This avoids that condition. - I thought this was fixed before but apparently not. --- icebergs_io.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/icebergs_io.F90 b/icebergs_io.F90 index 6ed119c..2293f18 100644 --- a/icebergs_io.F90 +++ b/icebergs_io.F90 @@ -800,7 +800,7 @@ subroutine read_restart_bergs(bergs,Time) allocate(iceberg_num(nbergs_in_file)) endif - if (found_restart) then + if (found_restart .and. nbergs_in_file > 0) then call read_unlimited_axis(filename,'lon',lon,domain=grd%domain) call read_unlimited_axis(filename,'lat',lat,domain=grd%domain) call read_unlimited_axis(filename,'uvel',uvel,domain=grd%domain)