SteamUserStats() generating crash

Hello everyone,

I have a problem with the Steam API when I try to find a leaderboard.

Looks like SteamUserStats() is not returning what it is meant to.

This is what I am doing:

1 - At the begining:

CSteamLeaderboards* g_SteamLeaderboards = NULL; // Global variable

...

	// Initialize Steam
	bool bRet = SteamAPI_Init();

	// Create the SteamLeaderboards object if Steam was successfully initialized
	if (bRet)
	{
		g_SteamLeaderboards = new CSteamLeaderboards();
	}

2 - Run SteamAPI_RunCallbacks() every tick.

3 - When I try to find the leaderboard:

if (g_SteamLeaderboards)
{
	g_SteamLeaderboards->FindLeaderboard(LEADERBOARD_TIME);
}

4 - My CSteamLeaderboard.cpp (exactly the same as Spacewar example):

CSteamLeaderboards::CSteamLeaderboards() : m_CurrentLeaderboard(NULL), m_nLeaderboardEntries(0)
{
}

void CSteamLeaderboards::FindLeaderboard(const char *pchLeaderboardName)
{
	m_CurrentLeaderboard = NULL;

	SteamAPICall_t hSteamAPICall = SteamUserStats()->FindLeaderboard(pchLeaderboardName); // <---- THE ERROR POINTS TO THIS LINE
	m_callResultFindLeaderboard.Set(hSteamAPICall, this, &CSteamLeaderboards::OnFindLeaderboard);
}

This is the crash log I get:

Unknown exception - code c06d007f (first/second chance not available)
KERNELBASE
UE4Editor_EliosisHunt!__delayLoadHelper2() [f:\dd\vctools\delayimp\delayhlp.cpp:386]
UE4Editor_EliosisHunt!_tailMerge_steam_api64_dll()
UE4Editor_EliosisHunt!CSteamAPIContext::Init() [c:\program files\epic games\4.11\engine\source\thirdparty\steamworks\steamv137\sdk\public\steam\steam_api_internal.h:92]
UE4Editor_EliosisHunt!CSteamLeaderboards::FindLeaderboard() [c:\unreal files\eliosishuntworkspace\eliosishunt\source\eliosishunt\private\csteamleaderboards.cpp:19

What am I doing wrong?

Thanks in advance.

Did you ever figure this out? I just started getting it seemingly randomly and now I can’t even open my project