eval/typval_encode: Handle NULL partials properly

This commit is contained in:
ZyX
2017-01-03 07:44:54 +03:00
parent 9c84f3ba3e
commit 06cca5dc59

View File

@@ -87,7 +87,7 @@
/// @brief Macros used when starting to convert a funcref or a partial /// @brief Macros used when starting to convert a funcref or a partial
/// ///
/// @param tv Pointer to typval where value is stored. May not be NULL. /// @param tv Pointer to typval where value is stored. May not be NULL.
/// @param fun Function name. /// @param fun Function name. May be NULL.
/// @def TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS /// @def TYPVAL_ENCODE_CONV_FUNC_BEFORE_ARGS
/// @brief Macros used before starting to convert partial arguments /// @brief Macros used before starting to convert partial arguments
@@ -317,7 +317,7 @@ static int _TYPVAL_ENCODE_CONVERT_ONE_VALUE(
case VAR_PARTIAL: { case VAR_PARTIAL: {
partial_T *const pt = tv->vval.v_partial; partial_T *const pt = tv->vval.v_partial;
(void)pt; (void)pt;
TYPVAL_ENCODE_CONV_FUNC_START(tv, pt->pt_name); TYPVAL_ENCODE_CONV_FUNC_START(tv, (pt == NULL ? NULL : pt->pt_name));
_mp_push(*mpstack, ((MPConvStackVal) { _mp_push(*mpstack, ((MPConvStackVal) {
.type = kMPConvPartial, .type = kMPConvPartial,
.tv = tv, .tv = tv,