In Medieval Sweden, it would be unlikely that you had your entire crop fail, as you would always have multiple crops on multiple fields.
Regardless whether you were a free-holding peasant (around 52% or the arable soil in 1400) or a tenant on noble, church or crown held (21, 21 and 6% respectively around 1400) you farmed communally. This meant that you and your fellow peasants in the village worked together on multiple field and took a percentage of the yield there according to their ownership or tenancy - since inheritance of land (and tenancy) in Sweden was split between the sons of a peasants, after a few generations a field had been divided into a patchwork of tenancies and ownerships, so working together and splitting the yield was really the only possible way to work the land. Add the fact that before iron became cheap enough to be available to everyone, tools were either wooden or wooden with an iron rim. This meant that much more labour was needed to drain, plow and harrow a field - often too much for a single family to do in the timeframe the field needed for optimal yield. Thus the commune of peasants went from field to field on a known rotation, working the fields at the times they needed to be worked - for example, fields lying high and sloping to the south would thaw and drain much earlier than fields lying low and sloping to the north, and could thus be sowed earlier.
As you can see, it was unlikely that you would suffer a crop failure without your neighbours suffering the same.
That said, you also had quite a few other ways to avoid starvation. Swedish peasants grew mostly rye as their corn (meaning the most common grain), despite wheat being much more productive, since it took hardier wheat strands and iron plows to protect the wheat harvest from frost. Although barley and oats were not uncommon either. But that was only what was grown in the prime fields. More marginal fields were used to grow peas, beans and cabbages as well as various kind of onions or herbs. If one crop failed, you often had others that would still grow.
Of course, if you had a very bad year, multiple crops could fail, and you could face more problems. Peasants knew this, and often had reserves and backups. You don't really see starvation in the countryside until you've had multiple years of multiple crop failures.
If you had multiple years of multiple crop failures, the peasants often had to rely on other sources of food. Cash crops (which were often other things than crops) were used to gain money for trade. This could be things such as raising pigs and renting royal oak forests to let them eat acorns (pork fed on acorns was a prized delicacy), burning tar, chopping lumber, growing rape seed for oil, growing hemp for cloth and ropes, keeping sheep for wool or keeping cows or goats for milk and make butter or cheese to sell. Most Medieval Swedish villages had common land for grazing and forests that were "free" to take whatever you wanted and could from.
You could then either sell your cash crops and look to buy food for the money, or slaughter the animals and eat them, although that would seriously hurt your ability to make money in the future.
The Swedish Medieval County Laws were specifically designed to make all landed (regardless whether self-owning or a tenant) peasants equal before the law - from the highest proto-nobility or nobleman (Swedish nobility was created in 1280 with the Alnsö Law) to the lowest tenant, especially after thralldom was abolished in 1337, which rhymes well with the close-knit communes that Medieval villages formed. If you only had part in fields that failed, your neighbours would most likely aid you to make sure you did not starve.
There were also some relief to be found in the church - the tithe to the catholic church was divided into parts where some went to the local parish priest and the remaining part would be divided into three parts - one for the church as whole, one for the bishop and one for charity for the poor. In the Östgöta law, this was set as a third for the parish priest and two ninths to each of the other three categories.
So, to sum up. You would have a wide range of fields and crops you farmed together with others, so the entire harvest going bad at once was unlikely. If that still happened, you would rely on your own reserves or cash crops to help you. If that was not enough, the charity of your neighbours, if that was not enough, the part of the church tithe reserved for charity.
Of course, it regularly happened that all of this was not enough, and starvation was imminent. Often because even if you could buy food, infrastructure was such that large amounts could not be moved quickly unless you were close to a port.