Fix crash in CString's 'debugDescription' when the underlying pointer is null.

Fixes <rdar://problem/16227050>

Swift SVN r18202
This commit is contained in:
Ted Kremenek
2014-05-16 18:03:51 +00:00
parent def1f53b7d
commit fc47f11a29
2 changed files with 8 additions and 0 deletions

View File

@@ -68,6 +68,9 @@ struct CString :
extension CString : DebugPrintable {
var debugDescription: String {
if isNull() {
return "<null C string>"
}
return String.fromCString(self).debugDescription
}
}