Why error is there

  • Автор темы Автор темы lokiys
  • Дата начала Дата начала

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 922
Реакции
1 206
Баллы
113
Why I'm sometimes getting error from this code:

C#:
Развернуть Свернуть Копировать
var r = new Random();
int rand = r.Next(1, 12);
System.Threading.Thread.Sleep(1000);
if(rand == 1) project.Profile.Login = project.Profile.Surname + project.Profile.Age;
else if(rand == 2) project.Profile.Login = project.Profile.Login;
else if(rand == 3) project.Profile.Login = project.Profile.Name + project.Profile.Age + project.Profile.Surname;
else if(rand == 4) project.Profile.Login = project.Profile.Name + "." + project.Profile.Surname;
else if(rand == 5) project.Profile.Login = project.Profile.Name + project.Profile.Surname + project.Profile.Age;
else if(rand == 6) project.Profile.Login = project.Profile.CurrentRegion + project.Profile.Age;
else if(rand == 7) project.Profile.Login = project.Profile.Interest + project.Profile.Age;
else if(rand == 8) project.Profile.Login = project.Profile.NickName;
else if(rand == 9) project.Profile.Login = project.Profile.Name + project.Profile.ZipCode;
else if(rand == 10) project.Profile.Login = project.Profile.Name + project.Profile.BornYear;
else if(rand == 11) project.Profile.Login = project.Profile.Surname + project.Profile.BornYear;

Error message: Object reference not set to an instance of an object.
 
Works fine in PM in latest build :bw:
 
Profile.Interest ?
 

Looks like really this will make error, but check there is such string in c#. You can define project.Profile.Interest but when you try to execute then there is this error Object reference not set to an instance of an object.

Means that need to delete it from possible options...
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)