author | erik <erik> | 2007-01-22 23:01:41 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-22 23:01:41 (UTC) |
commit | adcf6075db477909dd8170a74862a6ef91a5127f (patch) (unidiff) | |
tree | da0a1e35c5d392271bce29e84d3af5c30a864f56 /noncore/net/opieirc | |
parent | 9b4871054d01a47b4c546952a0948553413840d6 (diff) | |
download | opie-adcf6075db477909dd8170a74862a6ef91a5127f.zip opie-adcf6075db477909dd8170a74862a6ef91a5127f.tar.gz opie-adcf6075db477909dd8170a74862a6ef91a5127f.tar.bz2 |
Each file in this commit had a problem where a function might return
a null value for a pointer and that null value was not checked.
-rw-r--r-- | noncore/net/opieirc/ircsession.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/noncore/net/opieirc/ircsession.cpp b/noncore/net/opieirc/ircsession.cpp index c8d7869..d87ff80 100644 --- a/noncore/net/opieirc/ircsession.cpp +++ b/noncore/net/opieirc/ircsession.cpp | |||
@@ -131,27 +131,29 @@ void IRCSession::updateNickname(const QString &oldNickname, const QString &newNi | |||
131 | if(!person) { | 131 | if(!person) { |
132 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person"))); | 132 | emit outputReady(IRCOutput(OUTPUT_ERROR, tr("Nickname change of an unknown person"))); |
133 | return; | 133 | return; |
134 | } | 134 | } |
135 | 135 | ||
136 | getChannelsByPerson(person, channels); | 136 | getChannelsByPerson(person, channels); |
137 | output = IRCOutput(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg(oldNickname).arg(newNickname)); | 137 | output = IRCOutput(OUTPUT_NICKCHANGE, tr("%1 is now known as %2").arg(oldNickname).arg(newNickname)); |
138 | } | 138 | } |
139 | 139 | ||
140 | QListIterator<IRCChannel> it(channels); | 140 | QListIterator<IRCChannel> it(channels); |
141 | for (;it.current(); ++it) { | 141 | for (;it.current(); ++it) { |
142 | IRCChannelPerson *chanperson = it.current()->getPerson(oldNickname); | 142 | IRCChannelPerson *chanperson = it.current()->getPerson(oldNickname); |
143 | it.current()->removePerson(chanperson); | 143 | if (chanperson) { |
144 | chanperson->setNick(newNickname); | 144 | it.current()->removePerson(chanperson); |
145 | it.current()->addPerson(chanperson); | 145 | chanperson->setNick(newNickname); |
146 | it.current()->addPerson(chanperson); | ||
147 | } | ||
146 | } | 148 | } |
147 | 149 | ||
148 | emit updateChannels(); | 150 | emit updateChannels(); |
149 | output.addParam(new QString(newNickname)); | 151 | output.addParam(new QString(newNickname)); |
150 | emit outputReady(output); | 152 | emit outputReady(output); |
151 | } | 153 | } |
152 | 154 | ||
153 | IRCChannel *IRCSession::getChannel(QString channelname) { | 155 | IRCChannel *IRCSession::getChannel(QString channelname) { |
154 | QListIterator<IRCChannel> it(m_channels); | 156 | QListIterator<IRCChannel> it(m_channels); |
155 | for (; it.current(); ++it) { | 157 | for (; it.current(); ++it) { |
156 | if (it.current()->channelname() == channelname) { | 158 | if (it.current()->channelname() == channelname) { |
157 | return it.current(); | 159 | return it.current(); |