You can't be blamed if you sold out of airline stocks as the COVID-19 pandemic decimated the industry. After all, one of the greatest names in investing dumped massive airline stakes at a loss during the panic.

But investing can be humbling, even for Warren Buffett, and the stocks have been surging of late on growing optimism that the worst of the travel drought is behind us.

LUV Chart

Airlines data by YCharts

The stocks have come a long way off their lows, but the recovery is still fragile, and risks remain. Here's a look at where the sector stands, and whether investors should be looking to buy or sell right now.

The case to buy

COVID-19 has hit airlines hard, with companies in March seeing more cash flowing out the door in refunds than they were taking in via new bookings. Some of the largest airlines were burning through more than $100 million per day at the peak of losses, a rate no carrier can sustain for long.

But the market largely underestimated how healthy the airline sector was heading into the crisis, and its ability to quickly raise fresh liquidity. It's understandable investors would assume the worst: Airlines historically have fared poorly through recessions, with the U.S. industry producing more than 100 bankruptcies since late-1970s deregulation.

This time really was different. A round of bankruptcies followed by consolidation a decade ago created a stable, more resilient industry that came into 2020 generating solid profits and with significant unencumbered assets from which to borrow. Since March, U.S. airlines have raised nearly $20 billion in new debt and equity financing, and have a $50 billion backstop from the U.S. government to fall back on.

Airline ground worker directing a plane to the terminal.

Image source: Getty Images.

The money bought the industry time to wait out the pandemic and hope for a recovery, and recent evidence suggests we have bounced off the bottom.

The Transportation Security Administration (TSA) is currently screening airport passengers at numbers not seen since early March, and American Airlines Group (AAL 1.51%) said it was adding back domestic flights because its average number of daily passengers had more than tripled compared to April.

Airline shares had fallen to levels that assumed bankruptcies were inevitable, and if a recovery is at hand the industry looks cheap. Even after the rally only one carrier, Allegiant Travel (ALGT -1.83%), trades at more than one time sales, and heavyweights including American and United Airlines Holdings (UAL 1.59%) trade at less than 0.3 times sales.

Investors are going to need to be patient, because even in a recovery revenue is likely to take more than a year to return to pre-pandemic levels. But for those willing to wait out a recovery, the potential for outsized returns is there.

The case to sell

The problem with the "bull" case for airlines is the number of "ifs" required to make it. It looks safe to dive into airline stocks if travel demand trends continue to rise, which will only happen if the economy remains stable and if there is no second wave to the pandemic.

At best, any prediction about what the next six months will bring us in terms of the pandemic or the economy is a guess. And if things go wrong, they could go very wrong for the airlines.

As of now, travel is recovering but it is far from normal. The TSA screening stations at airports are busier than they were, but still off 80% or more compared to 2019 levels. Airlines are adding flights, but will still fly at best half of their July domestic schedules compared to a year ago. International and corporate travel, which make up the bulk of profits for many airlines, could take years to return.

The airlines are telling us they have all but ruled out returning to their pre-pandemic size any time soon. Even as it was adding flights, American Airlines was also eliminating about 30% of its corporate and support workers, and United, Delta Air Lines (DAL 4.05%), and Southwest Airlines (LUV -6.96%), among others, are offering buyouts or planning for potential furloughs in the fall.

Even if demand does accelerate from here, the airlines are going to spend years devoting a significant percentage of cash flow to paying down the massive piles of new debt taken on during the pandemic. Heading into 2020, the airlines were healthy enough to do significant stock buybacks and some paid a dividend. In almost all scenarios, the potential for cash return in the years to come looks minimal at best.

Should you buy or sell?

For both bulls and bears, it is important to acknowledge the risks to airlines. A second wave of the pandemic scares me more than an economic recession, as the airlines have the cash on hand to navigate through a run-of-the-mill downturn. But a return to March and April pandemic conditions, with the corresponding drop in demand, could be lethal to at least some airlines.

That's a risk that can't be calculated. We just don't know whether the pandemic will be contained, or if the situation will be more dire weeks or months from now. The stocks could easily give back their recent gains in the months to come. For some investors, especially those without a tolerance for significant risk, that's reason enough to stay on the sidelines.

A plane flies above the clouds.

Image source: Getty Images.

I believe the airlines have enough financial runway to get through 2020, and that in all but the worst-case scenarios the industry can avoid bankruptcies that would wipe out equity holders. But the risk is real enough that investors should limit airline exposure to a small part of the overall portfolio. And be careful what you buy.

Southwest has a fortress balance sheet and a well-earned reputation as a top operator. Delta has more than enough cash to survive past 2020, even assuming no further revenue growth or cost cuts, and should be able to get to cash-flow breakeven by the fourth quarter. Alaska Air Group (ALK 0.72%) also looks well-positioned to take advantage of a domestic-focused recovery.

The first half of 2020 has been a volatile ride for airline investors, and given the challenges on the horizon, there's no reason to expect calm skies up ahead. I think it is safe to buy into airline shares, but keep your seatbelt fastened and be prepared to navigate through turbulence.