cinera.c: Fix segfault on partial hmmlib1 credit
This commit is contained in:
parent
b0501d20ac
commit
07795b7cbd
|
@ -23,7 +23,7 @@ typedef struct
|
||||||
version CINERA_APP_VERSION = {
|
version CINERA_APP_VERSION = {
|
||||||
.Major = 0,
|
.Major = 0,
|
||||||
.Minor = 8,
|
.Minor = 8,
|
||||||
.Patch = 17
|
.Patch = 18
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <stdarg.h> // NOTE(matt): varargs
|
#include <stdarg.h> // NOTE(matt): varargs
|
||||||
|
@ -6687,6 +6687,14 @@ void
|
||||||
ErrorRole(string HMMLFilepath, string Role)
|
ErrorRole(string HMMLFilepath, string Role)
|
||||||
{
|
{
|
||||||
ErrorFilenameAndLineNumber(&HMMLFilepath, 0, S_ERROR, ED_INDEXING);
|
ErrorFilenameAndLineNumber(&HMMLFilepath, 0, S_ERROR, ED_INDEXING);
|
||||||
|
if(Role.Length == 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Credit lacks a role\n");
|
||||||
|
fprintf(stderr, " A complete credit takes the form:\n"
|
||||||
|
" credit = creditable_person:their_role\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fprintf(stderr, "No such role: %s%.*s%s\n",
|
fprintf(stderr, "No such role: %s%.*s%s\n",
|
||||||
ColourStrings[CS_YELLOW_BOLD],
|
ColourStrings[CS_YELLOW_BOLD],
|
||||||
(int)Role.Length, Role.Base,
|
(int)Role.Length, Role.Base,
|
||||||
|
@ -6698,6 +6706,7 @@ ErrorRole(string HMMLFilepath, string Role)
|
||||||
" plural = \"Rollae\";\n"
|
" plural = \"Rollae\";\n"
|
||||||
" position = -1;\n"
|
" position = -1;\n"
|
||||||
" }\n", (int)Role.Length, Role.Base);
|
" }\n", (int)Role.Length, Role.Base);
|
||||||
|
}
|
||||||
WaitForInput();
|
WaitForInput();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -6800,6 +6809,12 @@ Uncredited(HMML_VideoMetaData *Metadata, credit *C)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
IsValidCredit(credit *Credit)
|
||||||
|
{
|
||||||
|
return Credit->Person && Credit->Role;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MergeCredits(memory_book *Credits, project *CurrentProject, HMML_VideoMetaData *Metadata)
|
MergeCredits(memory_book *Credits, project *CurrentProject, HMML_VideoMetaData *Metadata)
|
||||||
{
|
{
|
||||||
|
@ -6807,7 +6822,7 @@ MergeCredits(memory_book *Credits, project *CurrentProject, HMML_VideoMetaData *
|
||||||
for(int ProjectCreditIndex = 0; ProjectCreditIndex < CurrentProject->Credit.ItemCount; ++ProjectCreditIndex)
|
for(int ProjectCreditIndex = 0; ProjectCreditIndex < CurrentProject->Credit.ItemCount; ++ProjectCreditIndex)
|
||||||
{
|
{
|
||||||
credit *Credit = GetPlaceInBook(&CurrentProject->Credit, ProjectCreditIndex);
|
credit *Credit = GetPlaceInBook(&CurrentProject->Credit, ProjectCreditIndex);
|
||||||
if(!Uncredited(Metadata, Credit) && Credit->Role && !GetCredit(Credits, Credit))
|
if(IsValidCredit(Credit) && !Uncredited(Metadata, Credit) && !GetCredit(Credits, Credit))
|
||||||
{
|
{
|
||||||
credit *New = MakeSpaceInBook(Credits);
|
credit *New = MakeSpaceInBook(Credits);
|
||||||
New->Person = Credit->Person;
|
New->Person = Credit->Person;
|
||||||
|
@ -6821,7 +6836,7 @@ MergeCredits(memory_book *Credits, project *CurrentProject, HMML_VideoMetaData *
|
||||||
credit Credit = {};
|
credit Credit = {};
|
||||||
Credit.Person = GetPersonFromConfig(Wrap0(This->name));
|
Credit.Person = GetPersonFromConfig(Wrap0(This->name));
|
||||||
Credit.Role = GetRoleByID(Config, Wrap0(This->role));
|
Credit.Role = GetRoleByID(Config, Wrap0(This->role));
|
||||||
if(!Uncredited(Metadata, &Credit) && Credit.Role && !GetCredit(Credits, &Credit))
|
if(IsValidCredit(&Credit) && !Uncredited(Metadata, &Credit) && !GetCredit(Credits, &Credit))
|
||||||
{
|
{
|
||||||
credit *New = MakeSpaceInBook(Credits);
|
credit *New = MakeSpaceInBook(Credits);
|
||||||
New->Person = Credit.Person;
|
New->Person = Credit.Person;
|
||||||
|
@ -6840,7 +6855,7 @@ MergeCredits(memory_book *Credits, project *CurrentProject, HMML_VideoMetaData *
|
||||||
credit Credit = {};
|
credit Credit = {};
|
||||||
Credit.Person = GetPersonFromConfig(Wrap0(This->value));
|
Credit.Person = GetPersonFromConfig(Wrap0(This->value));
|
||||||
Credit.Role = GetRoleByID(Config, Wrap0(RoleIDStrings[ThisAttribute->RoleID]));
|
Credit.Role = GetRoleByID(Config, Wrap0(RoleIDStrings[ThisAttribute->RoleID]));
|
||||||
if(!Uncredited(Metadata, &Credit) && Credit.Role && !GetCredit(Credits, &Credit))
|
if(IsValidCredit(&Credit) && !Uncredited(Metadata, &Credit) && !GetCredit(Credits, &Credit))
|
||||||
{
|
{
|
||||||
credit *New = MakeSpaceInBook(Credits);
|
credit *New = MakeSpaceInBook(Credits);
|
||||||
New->Person = Credit.Person;
|
New->Person = Credit.Person;
|
||||||
|
|
Loading…
Reference in New Issue