Floods, conflicts and epidemics can destroy crops and cut off food supplies. New analysis shows countries can build resilience to stop these shocks from turning into hunger crises.