1 00:00:00,000 --> 00:00:00,360 2 00:00:00,360 --> 00:00:02,390 >> SPEAKER 1: It turns out this program, short though it is, 3 00:00:02,390 --> 00:00:03,770 actually has a bug. 4 00:00:03,770 --> 00:00:08,060 In rare circumstances, GetString, per its own documentation, can return 5 00:00:08,060 --> 00:00:09,390 something other than a string. 6 00:00:09,390 --> 00:00:12,700 Specifically, a sentinel, a special value called null-- 7 00:00:12,700 --> 00:00:14,080 N-U-L-L. 8 00:00:14,080 --> 00:00:17,350 >> Null signifies that generally, something went wrong whereby in this 9 00:00:17,350 --> 00:00:20,340 case, the user might have typed in such a big string that it wouldn't fit 10 00:00:20,340 --> 00:00:23,610 in memory, and so GetString might return null in that case. 11 00:00:23,610 --> 00:00:26,650 >> Or it might be that the user somehow didn't type any string at all, in 12 00:00:26,650 --> 00:00:28,570 which case no string can come back. 13 00:00:28,570 --> 00:00:31,200 So it's best that we detect whether or not null has 14 00:00:31,200 --> 00:00:33,200 been returned as follows-- 15 00:00:33,200 --> 00:00:40,270 Only if S does not equal null should I proceed to execute this loop. 16 00:00:40,270 --> 00:00:43,520 >> In other words, if GetString happens to return null, I'm not going to 17 00:00:43,520 --> 00:00:46,880 accidentally try iterating over characters that simply are not there. 18 00:00:46,880 --> 00:00:49,597