TReKiE / msnp-sharp

Automatically exported from code.google.com/p/msnp-sharp
0 stars 0 forks source link

Hardcoded array indices in MSNPSharp.EmoticonMessage.ParseBytes() result in emoticon download problems #37

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Send more than one custom emoticon to MSNPSharp.

What is the expected output? What do you see instead?

Expected result is the automatic downloading of custom emoticons. Instead, 
only the first one is requested to be downloaded, but for as many times as 
there are unique custom emoticons.

What version of the product are you using? On what operating system?

Version is 205 stable on Windows XP Pro.

Please provide any additional information below.

The corrected code in MSNPSharp.EmoticonMessage.ParseBytes() is shown below 
(changes to 3 lines):

            for(int i = 0; i < values.Length - 1; i += 2)
            {
                Emoticon emoticon = new Emoticon();
                emoticon.Shortcut = values[i].Trim();
                emoticon.ParseContext(values[i+1].Trim());

                Emoticons.Add(emoticon);
            }

Original issue reported on code.google.com by its....@gmail.com on 31 Oct 2008 at 1:22

GoogleCodeExporter commented 9 years ago
Fixed

Original comment by freezing...@gmail.com on 31 Oct 2008 at 7:45

GoogleCodeExporter commented 9 years ago
Thanks, you may also want to modify the for loop so that it won't iterate over 
an 
array containing a single item and result in the i+1 throwing an exception:

For example, change:
for (int i = 0; i < values.Length; i += 2)

To:
for (int i = 0; i < values.Length - 1; i += 2)

Original comment by its....@gmail.com on 31 Oct 2008 at 11:03

GoogleCodeExporter commented 9 years ago
OMG...fixed, thanks

Original comment by freezing...@gmail.com on 1 Nov 2008 at 7:05

GoogleCodeExporter commented 9 years ago

Original comment by hepha...@gmail.com on 18 Nov 2008 at 9:17

GoogleCodeExporter commented 9 years ago

Original comment by hepha...@gmail.com on 23 Jan 2009 at 5:41