mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
json: fix raw json string decoding crash when expected key is missing (#7206)
This commit is contained in:
@ -111,6 +111,22 @@ pub fn tos3(s charptr) string {
|
||||
}
|
||||
}
|
||||
|
||||
// Same as `tos2`, but returns empty string on nil ptr
|
||||
pub fn tos4(s byteptr) string {
|
||||
if s == 0 {
|
||||
return ""
|
||||
}
|
||||
return tos2(s)
|
||||
}
|
||||
|
||||
// Same as `tos4`, but for char*, to avoid warnings
|
||||
pub fn tos5(s charptr) string {
|
||||
if s == 0 {
|
||||
return ""
|
||||
}
|
||||
return tos3(s)
|
||||
}
|
||||
|
||||
[deprecated]
|
||||
pub fn tos_lit(s charptr) string {
|
||||
eprintln('warning: `tos_lit` has been deprecated, use `_SLIT` instead')
|
||||
|
Reference in New Issue
Block a user