problem with params.

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
adrian_007
Posts: 32
Joined: 2006-03-06 10:54
Location: Poland

problem with params.

Post by adrian_007 » 2006-10-16 10:13

hi all,
i want to include raw manager from zion and i have problem with getting parametes. i have something like this:
in user.cpp

Code: Select all

const string Identity::formattedRawCommand(const string& aRawCommand, const string& file, const string& c) {
//	if(!getProtectedUser()) {
		SettingsManager::getInstance()->set(SettingsManager::TOTAL_RAW_COMMANDS_SENT, SETTING(TOTAL_RAW_COMMANDS_SENT) + 1);

		StringMap ucParams;
		ucParams["file"] = file;
		ucParams["adl"] = c;
		getParams(ucParams, "user", true);

		string rawCommand = Util::formatParams(aRawCommand, ucParams, false);

//		if(BOOLSETTING(LOG_RAW_COMMANDS)) { logRawCommand(rawCommand); }
		return rawCommand;
//	}
//	return Util::emptyString;
}
in client.cpp

Code: Select all

(...)
							OnlineUser* ou = NULL;
							string raw = ou->getIdentity().formattedRawCommand(i->getRaw(), file, c)
//if(!BOOLSETTING(USE_SEND_DELAYED_RAW)) {
								time += (i->getTime() * 1000) + 1;
								RawManager::getInstance()->addRaw(time, raw, this);
and when raw should be send, client crash, stops in first line of Identity::getParams

what shoul i do, to format raw command?
thanks.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Re: problem with params.

Post by GargoyleMT » 2006-10-20 18:06

adrian_007 wrote:

Code: Select all

							OnlineUser* ou = NULL;
							string raw = ou->getIdentity().formattedRawCommand(i->getRaw(), file, c)
//if(!BOOLSETTING(USE_SEND_DELAYED_RAW)) {
You're dereferencing a null pointer. That will of course crash. Since you apparently can use pieces of the identity, you need to get a real identity to use, or change the code not to reside in the identity class.

Locked