Let's face it -- it's not a lot of fun to be an investor right now. The S&P 500 (^GSPC 0.02%) is down more than 20% year to date despite a recent bout of bullishness, and stocks are still vulnerable to more summertime downside. At the very least, many investors are leery of taking on new trades, while some are still shedding existing positions out of sheer fear.

While the worry is certainly understandable, veteran investors know the time to be a buyer is when the majority of the crowd is in a panic. That's especially true when you're talking about stocks equipped to withstand the potential economic weakness that's got so many people worried.

Here's a rundown of three solid stocks you can add to your portfolio right now if you've got some idle cash you won't be needing for a while.

1. Dollar General

There's a reason shares of Dollar General (DG 0.30%) have been able to resist the recent bearish tide that's up-ended other retailers like Walmart (WMT 1.32%) and Target (TGT -0.70%). That reason is that Dollar General offers the deep values and convenience that not even Target and Walmart can provide. In an environment crimped by rampant inflation, this is a very big deal.

With nothing more than a passing glance, not even in-store shoppers might notice. Upon taking a close, careful look, though, consumers might recognize that many of Dollar General's products aren't quite the same products you'll find in a Walmart or Target store. Aside from slightly smaller package sizes negotiated with its suppliers, a good deal of Dollar General's inventory is actually private label stuff. Both allow the company to offer seemingly lower price points compared to its competitors.

Then there are the store chain's locations. The bulk of its 18,000-plus stores are located in communities with populations of less than 20,000, where you typically won't find a Walmart or Target. Yet, somehow, 75% of the United States' population lives within five miles of a Dollar General store.

Connect the dots. With average U.S. gasoline prices now near $5.00 per gallon, for many people, what used to be an affordable drive to a Walmart to do some cost-effective shopping has resulted in more trips to the nearest Dollar General.

Sure, these rising prices will eventually level off. There's no assurance they'll peel back anytime soon, though. In a poll recently taken by the Securities Industry and Financial Markets Association, 80% of economists fear stagflation (prices stuck at unusually high levels) is the global economy's greatest risk right now.

2. Medtronic

While consumers may be rethinking their discretionary and staples budgets, some expenditures -- like healthcare -- are still non-optional regardless of their cost. Fortunately, health insurers and hospitals are footing the bulk of these bills.

Enter Medtronic (MDT -1.12%). As the name more or less implies, the company manufactures medical electronics. Heart monitors and surgical tools are part of its portfolio aimed at hospitals, though it's got a handful of products marketed directly to individual patients, like its insulin-injecting InPen.

The need for these tools never really goes away. While demand ebbs and flows from time to time, and the company has certainly joined a number of organizations affected by the COVID-19 pandemic, it's a solid, steady long-term grower. This year's projected 1% revenue growth is tepid largely because the company is still dealing with a broken supply chain, but this weakness should be offset next year when sales are expected to roll in 5% better than this year's top line. Earnings are expected to grow even more, from last year's per-share profit of $5.55 to $5.57 this year to $6.03 per share in 2023 (fiscal 2024).

Perhaps the most compelling piece of the bullish argument for Medtronic, however, is its dividend and the above-average dividend yield of 3.1% stemming from the stock's 34% pullback from September's high. The company's upped its annual dividend payout for 45 consecutive years now as well, and these aren't small increases. The new quarterly payout of $0.68 per share is 8% better than the previous payment rate, and 48% bigger than its annual payout from five years ago. Yet, this payment still only consumes about half the company's typical profits. The rest can be reinvested in its own growth.

3. American Express

Finally, add credit card name American Express (AXP 0.07%) to your list of stocks you can feel good about stepping into here, particularly after its 30% tumble from February's high.

It seems like a somewhat counterintuitive pick. Lingering inflation not only stifles consumer spending but ultimately poses the risk of delinquent payments and even defaults on the card-based purchases the company facilitates. And AmEx may well end up taking a few lumps for these reasons.

The payment middleman may be more resilient than you think, however, for a couple of reasons.

The first of these reasons is that it's still not a credit card company in the purest sense of the term. As it has always been, American Express is a charge card company. While the distinction has been largely dismissed as meaningless semantics -- AmEx is still ultimately on the hook for those purchases, and still charges interest on outstanding balances -- its no-limit charge cards are also still preferred by businesses, which are more likely to pay on their charged balances than struggling individuals are. In this vein, roughly one-third of its profits come from commercial accounts rather than consumer charge cards.

The other reason American Express may hold up better than most of the stock's recent sellers seem to expect is that this company is very, very good at maintaining an ecosystem of cardmember perks. For instance, holders of its Blue Cash Preferred Card get 6% rebates on card-based purchases of groceries, as well as 6% of streaming-video subscription fees paid with their AmEx card. Blue Cash also gives back 3% on purchases of gasoline and transportation services.

The perks are so compelling, in fact, that most of its card offerings incur an annual fee that customers willingly pay. Even in a poor economy (and perhaps even more so in a poor economy), American Express's card fees can more than pay for themselves, maintaining the company's fee-based revenue without respect to its payment volume.