奇怪的报错 C# (新手求大神解答)

luhan8629989 2014-06-24 05:41:29
大神们,求帮忙看看为什么会报这个错?
System.NullReferenceException: Object reference not set to an instance of an object.
at ShootSearch.ShootSeg.Segment.SegmentText(String strText) in d:\Tools\ShootSearch_Segment_1_0_bate 070312\ShootSearch_Segment_1_0_bate 070312\ShootSeg\Segment.cs:line 482
at ShootSearch.ShootSeg.Segment.SegmentText(String strText, Boolean Enter) in d:\Tools\ShootSearch_Segment_1_0_bate 070312\ShootSearch_Segment_1_0_bate 070312\ShootSeg\Segment.cs:line 888
at SegTest.Form1.Main() in d:\Tools\ShootSearch_Segment_1_0_bate 070312\ShootSearch_Segment_1_0_bate 070312\SegTest\Form1.cs:line 129

报这个错的原因是我在main函数里加了这几句话(红色的):
Segment seg = new Segment();
string str="日前,奇虎董事长周鸿祎新推出了一款反流氓软件“360安全卫士”,并将雅虎中国3721网络实名定义为流氓软件。此举引起了雅虎员工的强烈不满,甚至有就职于雅虎的原3721员工声称将起诉周鸿祎。围绕着3721这个产品,引发了一场雅虎中国与奇虎之间的战争。";
seg.Separator = "/";
Console.WriteLine(seg.SegmentText(str,true));
报错对应的行:
line 482: if(h.ContainsKey(strChar1))
line 888: reText += SegmentText(strArr[i]) + "\r\n";
line 129: Console.WriteLine(seg.SegmentText(str,true));
...全文
71 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
碼上道 2014-06-24
  • 打赏
  • 举报
回复
有对象没有引用实际的实例对象。
707wk 2014-06-24
  • 打赏
  • 举报
回复
你是不是发错版块了?

69,382

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧